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

Replace first and last / slash

Status
Not open for further replies.

jasonhuibers

Programmer
Sep 12, 2005
290
CA
Here is my string:

/1234/456/900/abc/

How can I remove the first / and the last to make it:
1234/456/900/abc
 
[1] Non-slash-specific solution.
[tt] s="/1234/456/900/abc/"
t=mid(s,2,len(s)-2)
[/tt]
[2] Slash-specific solution.
[tt] s="/1234/456/900/abc/"
set rx=new regexp
with rx
.pattern="^/|/$"
.global=true
end with
u=rx.replace(s,"")
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top