substring help plz

sardon

New member
Joined
Jun 7, 2004
Messages
2
Programming Experience
1-3
Im not sure how to get what i want out of this string

userid%22%3Bi%3A3%3B%7D

i need to get whatever falls between userid%22%3Bi%3A and %3B%7D
in this example it happens to be the number 3
but it could be 2000.
Any help greatly appreciated

 
I would use the Replace method of the String structure.

If the variable str holds the string "userid%22%3Bi%3A3%3B%7D" use this code:

VB.NET:
strAnswer = str.Replace("userid%22%3Bi%3A", "").Replace("%3B%7D", "")

This line replaces the given strings with an empty string, functionally removing them.

You could also use a combination of the Substring and Indexof methods, but I think the example above is simpler.
 
Back
Top