473,566 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove Spaces

I try to remove the spaces with that method but it still dont work.
When i run in the debug mode it still shows spaces.

If (bCorpFound) Then
strCorp = LTrim(strCorp)
strCorp = RTrim(strCorp)
strCorp = Replace(strCorp , " ", "")
' strCurrentChar = Right(strCorp, 1)
' Do While (strCurrentChar = " ")
' Advance 1 char, from right
' strCorp = Left(strCorp, (Len(strCorp) - 1))
' strCurrentChar = Right(strCorp, 1)
' Loop
End If

Thank You.

Aug 21 '06 #1
4 4607
just use Replace.
?replace(" Text With Lots Of Spaces"," ","")
TextWithLotsOfS paces

Aug 21 '06 #2
Or better, try this:

Public Function RemoveExtraSpac es(ByVal strText As String) As String
'--Debug.Print "-" & strText & "-"
Do Until InStr(1, strText, " ") = 0
strText = Replace(strText , " ", " ")
Loop
'--Debug.Print "-" & strText & "-"
End Function

?removeextraspa ces(" My Text With Lots Of Spaces ")
- My Text With Lots Of Spaces -
- My Text With Lots Of Spaces -

Aug 21 '06 #3
co*********@gma il.com wrote:
I try to remove the spaces with that method but it still dont work.
When i run in the debug mode it still shows spaces.

If (bCorpFound) Then
strCorp = LTrim(strCorp)
strCorp = RTrim(strCorp)
strCorp = Replace(strCorp , " ", "")
' strCurrentChar = Right(strCorp, 1)
' Do While (strCurrentChar = " ")
' Advance 1 char, from right
' strCorp = Left(strCorp, (Len(strCorp) - 1))
' strCurrentChar = Right(strCorp, 1)
' Loop
End If

Thank You.
Maybe this is the problem:

http://groups.google.com/group/comp....8e898050f165ea

James A. Fortune
CD********@Fort uneJames.com

Aug 21 '06 #4
L.S.

There are even more flavours of spaces within the unicode-characterset
that is used within MS-Access internally. Probably the
comparision-method parameter of the replace-function will help when not
using the binary or database method, but using the text-method.
Sometimes when working on non-access database-tables blank-padding
occurs automatically, optionally or even mandatory. This also occurs
when declaring string variables with a fixed length within VBA. May be
that's the problem ..

Marc

CD********@Fort uneJames.com schreef:
co*********@gma il.com wrote:
I try to remove the spaces with that method but it still dont work.
When i run in the debug mode it still shows spaces.

If (bCorpFound) Then
strCorp = LTrim(strCorp)
strCorp = RTrim(strCorp)
strCorp = Replace(strCorp , " ", "")
' strCurrentChar = Right(strCorp, 1)
' Do While (strCurrentChar = " ")
' Advance 1 char, from right
' strCorp = Left(strCorp, (Len(strCorp) - 1))
' strCurrentChar = Right(strCorp, 1)
' Loop
End If

Thank You.

Maybe this is the problem:

http://groups.google.com/group/comp....8e898050f165ea

James A. Fortune
CD********@Fort uneJames.com
Aug 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
89946
by: Thomas Mlynarczyk | last post by:
Which is the simplest way to remove all whitespace from a string? Is there a simpler method than a regex replace? Or how can I tell a regex pattern to ignore all whitespace in my subject string? There is a global modifier to ignore all spaces in the pattern, but I couldn't find one for ignoring spaces in the subject string. Do I really have...
2
9213
by: john | last post by:
I am using this to remove everything except the 0-9 and a-z characters, but I also want to remove blanks spaces as well(yes even ones in between words) $strippedtext = preg_replace('//i','',$originaltext); Please help. Thx
1
4059
by: Danny | last post by:
Given this: "*" the pattern to remove the htnl code between brackets, how can I remove a series of spaces and just make one space. like here is a series of blank spaces thanks
2
2835
by: BobM | last post by:
I have two strings that I would like to compare. To guarantee the compare is not affected by trailing spaces, I would like to remove them. Will this do: MyTextBox.text.ToString().Trim()?
1
1795
by: Arjen | last post by:
Hello, In code view I use a tab as mark-up character. When I run my web application I can see the tabs with the source viewer in my browser. Is there a way to remove the tabs, extra spaces and lines when running the web application? I want to remove them for performance reasons.
3
7842
by: Danny Yeadon | last post by:
Hi I need to remove unwanted characters from phone numbers from my phone bill to analyse the data. Some examples are 02 48222222 i need to remove the space +61266667656 i need to remove the + 0427 221 529 i need to remove both spaces 0419 637 344MNET i need to remove the spaces...
7
2021
by: Mike Johnson | last post by:
How do I remove a item that's been selected from a listview? I'm using Visual Basic 2005 express edition. Thanks
34
4068
by: Registered User | last post by:
Hi experts, I'm trying to write a program that replaces two or more consecutive blanks in a string by a single blank. Here's what I did: #include <stdio.h> #include <string.h> #define MAX 80
15
15605
by: DanielJohnson | last post by:
I am writing a program in which I am removing all the spaces from the string. I thought that I could do it two ways. One was parsing the string character by character and copying onto another output string. But this was trivial. The other option is to use pointers and shift all the characters after the space by one space to the left. I did...
1
2501
by: buggtb | last post by:
Hi Guys, I've been given the joyous task of updating some very old scripts at work and I could do with a little help. Our Unix system dumps text files to pseudo spoolers that our windows machines can then pick up and process. Now the guy who wrote one of the reports is obviously a bit clueless and the certain lines don't match up so for...
0
7666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7951
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.