Substring: Difference between revisions

23 bytes removed ,  13 years ago
Updated D code
(Undo revision 109590 by Markhobley The change asks for a lot of tasks to be updated without flagging such, or mentioning it on the talk page.)
(Updated D code)
Line 411:
{{works with|D|2}}
<lang d>import std.stdio, std.string;
 
void main() {
stringconst strs = "the quick brown fox jumps over the lazy dog";
intenum n = 5, m = 3, i;
 
writeflnwriteln("%s", str[n .. n + m]);
 
writeflnwriteln("%s", str[n .. $]);
 
writeflnwriteln("%s", str[0 .. $ - 1]);
 
const i = strs.indexOf("q");
writeflnwriteln("%s", str[i .. i + m]);
 
iconst j = strs.indexOf("qu");
writeflnwriteln("%s", str[ij ..i j + m]);
}</lang>
Output:
Anonymous user