Operating with substrings in strings
kirklin.mcdonald at gmail.com
Fri Aug 18 11:56:21 PDT 2006
> Hi, i haven't found a function in the phobos lib to read a block of chars of a
> given length from a string taking the start index as a parameter, for example:
> we have the word "hello", i want to read starting from index 1 and i want this
> substring to have a length of 2, so the result should be "el", i've seen this
> in other languages, the function looks like: GetSubString(string mystring, int
> startindex, int length).
> Is there a way to acomplish this?
char h = "hello";
char sub = h[1..3] // Slice the string "hello"
writefln(sub); // Prints "el"
Pyd: Wrapping Python with D
More information about the Digitalmars-d-learn