Char[] confusing
grauzone
none at example.net
Mon Mar 2 16:24:57 PST 2009
Qian Xu wrote:
> Lutger wrote:
>> s[4] means the fifth element of s[]
>> s[0..4] is a slice from the first to the fifth, but not including the
>> fifth element. The last element in a slice is always one past the end
>> of that slice.
>
> Thank you both.
> I have to do math in mind in order to keep my code correct ;-)
>
>
> IMO, it does not make any sense.
> s[start..end]
>
> end - is neither the count of characters in the array slice,
> nor the end index of the slice.
> it is just the index after the real end character.
>
Think of it as "everything in the string before this."
More information about the Digitalmars-d-learn
mailing list