Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading parts of string 1

Status
Not open for further replies.

arkadia93

Programmer
Oct 19, 2006
110
GB
I have a string and I want to find a particular character, and then read the rest of the string from the character after that until the end of the string (e.g. if I have the string 'Order No:4745654', I only want the '4745654') Can anybody tell me how to do this?
 
The instr function will return the position in the string of the character you want to find, so if you used the mid function you could return a substring that started at the first instance found by instr and extended to len(string) (the length of the string).
 
You could use a function called Mid

it returns a specified number of characters from any position in a string

example:

dim strExtract

strextract ="Find Me in here"

response.write mid(strextract,6,2)

this will write the word: Me

i hope that helped
 
Thanks Ecwcee...that was just what I was looking for ;)
 
I think you would be a little safer off using something that will not restrict you to positioning yourself in the string like Regular Expressions

Here is a FAQ on it

How do I extract values from a given value?
faq333-3645

[sub]____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done[/sub]
 
What about using the split function with : as the watch character. Then just take the 2nd element in the array.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top