VB TRIM$ question
#1
Scooby Regular
Thread Starter
Join Date: Mar 2002
Location: Herts
Posts: 327
Likes: 0
Received 0 Likes
on
0 Posts
Hi All,
Does anyone know of a command that like TRIM$ removes spaces, will remove spaces AND tabs ???
I have not chosen REPLACE because i only want to manipulate the left and right of the string NOT anything in the middle.
My search proved a failure and as such i have written a loop that performs the job, but my curiosity has got the better of me and i want to know as to whether there is a command like REMOVE_ALL_WHITE_SPACE ??????
thanks scott
Does anyone know of a command that like TRIM$ removes spaces, will remove spaces AND tabs ???
I have not chosen REPLACE because i only want to manipulate the left and right of the string NOT anything in the middle.
My search proved a failure and as such i have written a loop that performs the job, but my curiosity has got the better of me and i want to know as to whether there is a command like REMOVE_ALL_WHITE_SPACE ??????
thanks scott
#2
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
can you not use substr or Left$ Right$ or similar...
otherwise I think you would have to do a loop and move through the string until you find chr(10) Or whatever..
David
otherwise I think you would have to do a loop and move through the string until you find chr(10) Or whatever..
David
#3
Scooby Regular
Thread Starter
Join Date: Mar 2002
Location: Herts
Posts: 327
Likes: 0
Received 0 Likes
on
0 Posts
Hi David,
The problem with LEFT$ or RIGHT$ is that i dont know where to start, there might be 1 .. 2 .. or 9 spaces or tabs.
So now i am back to my loop. I am still searching for that
REMOVE_ALL_WHITE_SPACE$(the_string) command
The problem with LEFT$ or RIGHT$ is that i dont know where to start, there might be 1 .. 2 .. or 9 spaces or tabs.
So now i am back to my loop. I am still searching for that
REMOVE_ALL_WHITE_SPACE$(the_string) command
#4
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
right then write it as a function called removeallwhitespaces(x as String)
then just do removeallwhitespaces("Test Blah")
David
then just do removeallwhitespaces("Test Blah")
David
#5
Scooby Regular
Thread Starter
Join Date: Mar 2002
Location: Herts
Posts: 327
Likes: 0
Received 0 Likes
on
0 Posts
Yep that is bascially what i have done
but my REMOVE_ALL_WHITE_SPACE(string) uses a loop blah blah blah
i wanted an internal VB method to use - just being lazy. well actually not really lazy - i have written my own method and both you and i are spending time trying to find an internal VB method for this.
Thanks for your advice
scott
but my REMOVE_ALL_WHITE_SPACE(string) uses a loop blah blah blah
i wanted an internal VB method to use - just being lazy. well actually not really lazy - i have written my own method and both you and i are spending time trying to find an internal VB method for this.
Thanks for your advice
scott
#6
Scooby Regular
Thread Starter
Join Date: Mar 2002
Location: Herts
Posts: 327
Likes: 0
Received 0 Likes
on
0 Posts
a collegue just blasted this out - totally forgot about the regular expressions !!!
Dim regEx As VBScript_RegExp_55.RegExp
Dim str As String
Set regEx = New VBScript_RegExp_55.RegExp
str = " " & vbTab & " ab " & vbTab & "cd " & vbTab & " "
regEx.Pattern = "\s+$"
str = regEx.Replace(str, "")
regEx.Pattern = "^\s+"
str = regEx.Replace(str, "")
MsgBox str
Dim regEx As VBScript_RegExp_55.RegExp
Dim str As String
Set regEx = New VBScript_RegExp_55.RegExp
str = " " & vbTab & " ab " & vbTab & "cd " & vbTab & " "
regEx.Pattern = "\s+$"
str = regEx.Replace(str, "")
regEx.Pattern = "^\s+"
str = regEx.Replace(str, "")
MsgBox str
Thread
Thread Starter
Forum
Replies
Last Post
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM
Pro-Line Motorsport
Car Parts For Sale
2
29 September 2015 07:36 PM