Robert Sanderson writes:
> To go right the way back to the beginning, the original requirement
> was to be able to say that you want to search for specific
> locations within a string, for example marc.008 =/substring=1:6
> 061223
>
> As substring isn't marc specific, (eg both SQL and XPath have a
> substring function), it was decided it should go into the cql
> context set. At which point several different extensions (such as
> negative numbers for counting backwards) were introduced to make it
> more featureful.
>
> This isn't covered by existing masking characters, so we do need at
> least start:length, where both start and length are positive
> integers.
Yes, of course. Which is exactly what the proposal said before we all
got sidetracked into inventing new ways to do truncation:
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
No negative numbers, no special cases.
Agreed?
_/|_ ___________________________________________________________________
/o ) \/ Mike Taylor <[log in to unmask]> http://www.miketaylor.org.uk
)_v__/\ "No no, no no no no, no no no no, no no; there's no limits" --
some bunch of talentless nobodies.
|