Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

VB TRIM$ question

Thread Tools
 
Search this Thread
 
Old 19 September 2002, 03:35 PM
  #1  
Scotty Boy
Scooby Regular
Thread Starter
 
Scotty Boy's Avatar
 
Join Date: Mar 2002
Location: Herts
Posts: 327
Likes: 0
Received 0 Likes on 0 Posts
Question

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
Old 19 September 2002, 03:39 PM
  #2  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
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
Old 19 September 2002, 03:46 PM
  #3  
Scotty Boy
Scooby Regular
Thread Starter
 
Scotty Boy's Avatar
 
Join Date: Mar 2002
Location: Herts
Posts: 327
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Old 19 September 2002, 04:46 PM
  #4  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
Post

right then write it as a function called removeallwhitespaces(x as String)

then just do removeallwhitespaces("Test Blah")



David
Old 19 September 2002, 04:53 PM
  #5  
Scotty Boy
Scooby Regular
Thread Starter
 
Scotty Boy's Avatar
 
Join Date: Mar 2002
Location: Herts
Posts: 327
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Old 19 September 2002, 05:06 PM
  #6  
Scotty Boy
Scooby Regular
Thread Starter
 
Scotty Boy's Avatar
 
Join Date: Mar 2002
Location: Herts
Posts: 327
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
Abx
Subaru
22
09 January 2016 05:42 PM
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM
Ganz1983
Subaru
5
02 October 2015 09:22 AM
Pro-Line Motorsport
Car Parts For Sale
2
29 September 2015 07:36 PM



Quick Reply: VB TRIM$ question



All times are GMT +1. The time now is 02:06 PM.