Jakob Voss writes:
> So 1-based should not be used because of additional non-standard
> fancy stuff that nobody will use, but because of it's standard in
> modern query languages.
Strong argument.
So how about this:
substring := <start1> [ ':' <length> ]
Where <start1> is a one-based character-count (0 is illegal) and the
:<length> is optional. If <length> is negative, it counts backwards
from the end of the string. So:
1:10 -- First ten characters
0:10 -- *error*
1 -- Whole string (from first to end)
2 -- All of string except the first character
1:-4 -- All of string except last four characters
2:-1 -- All of string except first and last characters
_/|_ ___________________________________________________________________
/o ) \/ Mike Taylor <[log in to unmask]> http://www.miketaylor.org.uk
)_v__/\ "If it were necessary to tolerate in other people everything
that one permits in oneself, life would be unbearable" --
Georges Courteline.
|