Numeric access to char[]
Peter Thomassen
info at peter-thomassen.de
Thu Aug 24 12:06:37 PDT 2006
Derek Parnell schrieb am Donnerstag, 24. August 2006 05:06:
>> Okay, nearly understood. But doesn't [0..1] produce two items, namely [0]
>> and [1]?
>
> The semantics of a slice specification is that the slice starts with the
> element indexed by the first index and extends to all the elements up to,
> but not including, the second index. Thus [0..1] means a slice containing
> element[0] only, and [4..7] means element[4], element[5], and element[6]
> is included in the slice, but not element[7]. To get all the elements
> except the last element we can use [0..$-1]
Thanks!
Peter
More information about the Digitalmars-d-learn
mailing list