jastrachan | 17 Mar 2005 11:57
Picon

Re: [groovy-dev] confusion in range for string

Firstly negative indices count from the end of the 
string/collection/array. -1 is the last item, -2 the one before etc.

Secondly ranges where the first value is greater than the second value 
auto-reverse the answer.

Does that help explain it?

On 17 Mar 2005, at 00:56, binwbwang wrote:
> I wrote following script
> // test.groovy
> s = "0123456789";
> println s[0...-3]
> println s[0..-3]
> println s[-3...0]
> println s[-3..0]
>
> the output in beta-10 is
>
> 012345678
> 01234567
> 789
> 76543210
>
> I can't know why. very very confusion.
>
>
>
>
>
>
>
>
> <image.tiff>
>
>    ~{MxRW~}188~{2F8;SJ~}--~{2F8;5DOsUw#;H+PB?*7E~}, ~{7a8;SC;'C{5HDzW"2a~}
>    ~{Wn4s~}5G~{?U<d#,8=<~~}40~{UWJU7"#;Cb7QW"2aLeQi~} http://www.188.com/ <image.tiff>
>

James
-------
http://radio.weblogs.com/0112098/


Gmane