View Full Version : Stripping Text
08-22-2002, 05:52 AM
I have a string of text:
The string reads:
how do i get rid of the "content/" part and the ".txt" part without effecting the "about" part
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 ?
08-27-2002, 12:48 AM
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...
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.