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

Extracting portion of varying lenth field - everything except last character

Status
Not open for further replies.

smmedeiros

Technical User
Feb 21, 2008
74
US
Can anyone share a method to extact all characters of a varying length field.. ALL but the very last character - mixed character type alpha & numeric

For example
abcd1234
results desired -> abcd123
abcde
results desired --> abcd
123ab45
results desired --> 123ab4


Thanks
 
The above formula assumes that the field has something to drop at the end. If it has a length less than 2, then it will error. If so, try:

stringvar strng := {Yourfield};
numbervar lngth := len(strng)-1;
if lngth > 0 then left(strng,lngth) else strng
 
AndyMC
Thank you for the help and quick reply!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top