|
-
Aug 2nd, 2005, 09:01 PM
#1
Thread Starter
Frenzied Member
Replacing a " " with nothing
Well in some of the data im getting back, it has alot of spaces infront of it. It looks something like:
" Data"
I just want "Data", what would I replace to make it so it only contains "Data"? At first I thought it would be something like
NewData = Replace(Data," ", VbNullstring)
but that does not work like I thought it would. Any idea?
-
Aug 2nd, 2005, 09:05 PM
#2
Re: Replacing a " " with nothing
that should work 100%, try trim though
trim(data)
-
Aug 2nd, 2005, 09:06 PM
#3
-
Aug 2nd, 2005, 09:14 PM
#4
Re: Replacing a " " with nothing
Do LTrim and RTrim run faster?
-
Aug 2nd, 2005, 09:17 PM
#5
-
Aug 2nd, 2005, 09:19 PM
#6
Lively Member
Re: Replacing a " " with nothing
Unless you are doing some crazy amount of trims in a row I don't think that you would notice any difference
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
Aug 2nd, 2005, 09:25 PM
#7
Re: Replacing a " " with nothing
Trim$ is faster than Trim because it doesn't have to be converted to a string.
-
Aug 2nd, 2005, 09:28 PM
#8
Thread Starter
Frenzied Member
Re: Replacing a " " with nothing
Okay, didn't know about the Trim command 
Anyways, since I dont really know it, im assuming it works the same as Replace in a way. I tried:
OppName1 = LTrim$(OppName)
Msgbox OppName1
The spaces were still there. Am I using it wrong?
-
Aug 2nd, 2005, 09:30 PM
#9
Re: Replacing a " " with nothing
Try Trim$ and see what happens, not LTrim$
-
Aug 2nd, 2005, 09:33 PM
#10
-
Aug 2nd, 2005, 09:35 PM
#11
Re: Replacing a " " with nothing
Unless he makes his own unique Trim$ statement. Could come in handy if done right.
-
Aug 2nd, 2005, 09:37 PM
#12
-
Aug 2nd, 2005, 09:40 PM
#13
Thread Starter
Frenzied Member
Re: Replacing a " " with nothing
*Edit* let me try it out.
-
Aug 2nd, 2005, 09:51 PM
#14
Re: Replacing a " " with nothing
If it always just a single space, you can use Mid$: String = Mid$(Text, 2)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|