Hi,
First of all I would say that, generally, having a number mean two
different things depending on its value is always a recipe for problems
and confusion.
Robert Sanderson wrote:
> On Sat, 5 Aug 2006, Robert Sanderson wrote:
>> substring="1:3" -- the first two characters
>> substring="1:1" -- the first character
>
> As pointed out to me, (thanks Adam!) the first example above is wrong.
> It would be the first three characters, as the end position is inclusive.
>
> The first two characters would be substring="1:2"
>
> Sorry for any confusion that may have caused.
Referring back to the original email:
> substring="-2:0" -- the last two characters // not possible currently
> substring="0:0" -- the last character
Shouldn't substring="-2:0" be the last *three* characters, as
substring="-1:0" would be the last two?
If the people on the list (who should know about these things) cannot
get it straight in their own minds what the various numbers mean, then
what hope have the users got of getting it right?
The proposed substring function is really many functions in
disguise. I reckon it is at least five distinct functions:
substring -- plain old fashioned substring with no hidden meaning
in the parameters, the substring from [first, last)
left_n -- left n characters
right_n -- right n characters
Don't really know what to call the next two:
remove_suffix_n -- the left part of the string after removing
the trailing n characters.
remove_prefix_n -- the right part of the string after removing
the leading n characters.
Regards,
Ashley.
--
Ashley Sanders [log in to unmask]
Copac http://copac.ac.uk A MIMAS Service funded by JISC
|