Operating with substrings in strings
keinfarbton at nospam.xyz
Fri Aug 18 13:03:49 PDT 2006
> char h = "hello";
> char sub = h[1..3] // Slice the string "hello"
> writefln(sub); // Prints "el"
I do not know much about UTF8. And I am often not sure if I do string
processing right. Can someone enlighten me?
If I have
char str = ... some multibyte utf8 chars;
What does str.length give me. The number of bytes or the number of
characters by looking at every character, which one are multi-bytes?
If I do some slicing (str[3..4]), does the indices slice at these byte
positions and I have the risk of destroying the string or does it look
at the characters to find the start of the third utf8 character?
Or did I miss something completely?
More information about the Digitalmars-d-learn