On Sunday, 27 October 2013 at 07:44:06 UTC, Jakob Ovrum wrote:
On Saturday, 26 October 2013 at 21:23:13 UTC, Gautam Goel wrote:
Dumb Newbie Question: I've searched through the library
reference, but I haven't figured out how to extract a
substring from a string. I'd like something like
string.substring("Hello", 0, 2) to return "Hel", for example.
What method am I looking for? Thanks!
There are a lot of good answers in this thread but I also think
they miss the real issue here.
I don't think so. It's indeed worth noticing that Phobos'
algorithms work with Unicode nicely, but:
a) working on indices is sometimes the actual functionality you
need
b) you need to allocate a new string from the range they return
(the slice functions in this thread don't)
c) do they really handle grapheme clusters? (I don't know)