Novell Home

Stripping characters from strings

Novell Cool Solutions: Question & Answer

Posted: 15 Dec 2005

Q:
I need to strip the last 8 characters from a string. According to the documentation, one can use "<-1" as start to get an "offset from the last character towards the start of the string" ... If I use that in a string-manipulation, the driver hard-stops.

A:
If you want just the last 8 characters, then use start="-9" length="8". If you want everything but 8 characters, then use start="0" length="-9".

The < -1 in the documentation indicates the range of numbers that are less than -1 rather than the literal string "<-1". For "start," this means -2 starts 1 characters from the end, -3 starts 2 characters from the end, etc. For length, -1 means the whole length the original string, -2 is the whole length -1, -3 the whole length -2.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

Novell® Making IT Work As One

© 2008 Novell, Inc. All Rights Reserved.