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

How to extract from a string value

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
US
I have a field in a query with the following construct...
/rawxx/value1
It has a slash followed by some characters then another slash followed by some characters. How can I pull out the characters following the second slash "/"...
In the old Clipper days there was STREXTRACT ...anything like that here/ Thanks
 
Left(yourStr, InStrRev(yourStr, "/"))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I think PHV meant:
Right(yourStr, InStrRev(yourStr, "/") - 1)
or you could also use:
Split(yourStr, "/")(2)
 
Dave, I'm not a native english speaker but, for me, 'pull out' is the same as 'remove', isn't it ?
 
After reading the original post again I see what you're saying. I didn't even think of it in that context but given the reference to STREXTRACT, I'm pretty sure Pack10 is looking for a way to retrieve the characters following the second slash.
 
Sorry PHV, I don't think I actually answered your question. I agree 'pull out' could be a synonym of 'remove', the question remains as to what you're interested in -- what you've just removed or what remains?
 
use split and choose what you want.

dim varTemp as variant

varTemp = split(string,"/",-1,vbtextcompare)

then vartemp will work as Array, select what you want
varTemp (0)
varTemp(1)
......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top