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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Truncation 1

Status
Not open for further replies.

MyBuddiesCallMeJosh

Technical User
Jan 26, 2003
1
US
Hi All

This is a fairly simple one. I have a string with a known prefix which I would like to truncate. For Example, if the string is "PrefixAnything", then I would just like to attain "Anything". I'm a new user to VBScript

Thanks

 
if the prefix is a set length then you can use the mid() function syntax = Mid(string, start[, length])
so if you have PrefixAnything and Prefix is a set value
then
Dim str, str2
str2 = "PrefixAnything"
str = Mid(str2, 7, Len(str2))
_______________________________________________
{ str = "sleep is good for you. sleep gives you the energy you need to function";
ptr = /sleep/gi;Nstr = str.replace(ptr,"coffee");alert(Nstr); }

_______________________________________________
for the best results to your questions: FAQ333-2924
has you're questio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top