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

Delete first and last character?

Status
Not open for further replies.

kylefield

Technical User
Nov 10, 2005
7
US
Is there a way (in a function) that I delete the first and last character of a string regardless of how long it is?

Thanks.
 
There's not a single function that will do it but something like:

[TT]Substr(lcText, 2, Len(lcText) - 2)[/TT]

Be careful if you're getting the text from the field of a table. You will have to use TRIM() to take the trailing spaces off.

Geoff Franklin
 
The leading spaces problem needs also to be addresses

SUBSTR(ALLTRIM(lcText),2,LEN(ALLTRIM(lcText))-2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top