Char[] confusing
Denis Koroskin
2korden at gmail.com
Mon Mar 2 15:41:39 PST 2009
On Tue, 03 Mar 2009 02:03:23 +0300, BCS <ao at pathlink.com> wrote:
> Reply to Qian,
>
>> Hi,
>> I am confusing with getting sub-string of a char[].
>>
> [..]
>> My question is: why s[4]=E, but s[0..4]=ABCD (without E)
>>
>
> Having the fist number be included and the second not works better than
> the other options.
>
> Consider what would have to change to make these work for the the other
> options:
>
> arr[0 .. n] and arr[n .. arr.length] cover the full array
>
> arr[0 .. 0] is empty
>
> arr[0 .. arr.length] is the full array
>
>
That and also
assert(arr[a..b].length == (b - a)); // evaluates to true always
More information about the Digitalmars-d-learn
mailing list