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 :D |
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 |
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) :D command |
right then write it as a function called removeallwhitespaces(x as String)
then just do removeallwhitespaces("Test Blah") :D David |
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 :D |
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 |
All times are GMT +1. The time now is 10:12 PM. |
© 2024 MH Sub I, LLC dba Internet Brands