Char[] confusing

Qian Xu quian.xu at stud.tu-ilmenau.de
Mon Mar 2 15:20:25 PST 2009


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.

-- 
Xu, Qian (stanleyxu)
  http://stanleyxu2005.blogspot.com


More information about the Digitalmars-d-learn mailing list