Click to See Complete Forum and Search --> : String Variable
eng70640
May 7th, 2001, 03:09 AM
I know that the 1st character of a unknown string variable is a number & the following characters are also numbers but do not know exactly how many following characters are numbers, so how can i exact only numbers from this string starting from the 1st character?
Cakkie
May 7th, 2001, 03:20 AM
This leaves all the non numbers from a string
dim strInput as string
dim strResult as string
strInput = "Th1s 15 a t35t 5tr1ng"
for t=1 to len(mystring)
if Isnumeric(mid(strInput,t,1)) then
' this is a number
strResult = strResult & mid(strInput,t,1)
end if
next t
' after this loop, strresult should have the value 1153551
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
eng70640
May 7th, 2001, 03:35 AM
How can i delete the first 3 characters of a string?
Cimperiali
May 7th, 2001, 03:39 AM
be sure the string is > 2 char
if len(mystr)> 2 then
mystr= right(mystr,len(mystr)-3)
end if
Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.