Click to See Complete Forum and Search --> : Left function
AndyC
Jan 14th, 2000, 09:54 PM
In my program I have strings like " 49 49 13 49 23 49" without the quotes and I use Trim to take away spaces then Left to take the firt two numbers but how can I "cut" the numbers out of the string?
Andy
geez, thanks. I 'assumed' AndyC had a brain, my mistake.
rino_2
Jan 15th, 2000, 04:58 AM
Could somebody please tell me how to use the Trim$(string)? I used this code to remove all the spaces but it did not work:
Trim(strString)
Whats wrong with that?
Thanks
it trims the all of the spaces before and after a string but not within the string. If you want to replace all of the spaces in a string try:
somevariable = replace("your string",Chr(32),"")
that removes all of the spaces in your string
[This message has been edited by pvb (edited 01-15-2000).]
use mid(string, start, length)
seeing as pvb didn't bother explaining it, this is how you use the MID function...
if you want the third number (13) do this:
MyNumber = mid(YourString, 7, 2)
"MyNumber" now contains the string "13", 7 in the brackets is the starting point of the desired string and "13" is 2 characters long, hence the 2 in the brackets.
if you want to convert this "13" into a number instead of a string, then use...
val(mid(YourString, 7, 2))
instead.
------------------
Wossname,
Email me: wossnamex@talk21.com :)
[This message has been edited by wossname (edited 01-15-2000).]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.