View Full Version : Stripping Text
mr_ego
08-22-2002, 04:52 AM
I have a string of text:
The string reads:
content/about.txt
how do i get rid of the "content/" part and the ".txt" part without effecting the "about" part
-Thanks
do you want to replace "content/about.txt" with "about" ?
if you want to select the text between / and . you can do this with the followin code (VB script):
dim positionslash, positiondot, string, resultlenght, begin, result 'string is your original string
positionslash = InStr(string,"/")
begin = positionslash + 1
positionpoint = InStr(string,".")
resultlenght = positionpoint - positionslash - 1
result = Mid(string,begin,resultlenght)
their might be a shorter way. anyone ?
whammy
08-26-2002, 11:48 PM
Not really - you could combine all that stuff into one line probably, but without doing that, matching it against a regular expression or using Split() would probably be about the same amount of code give or take a few bytes...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.