= String usage: split and splitlines = ''Part of'' StandardLibraryCategory == Description == Exercises std.string.splitlines and std.string.split. (Note: has simulatedFile to be 'self-contained'. Use commented out lines for real file, assumed to be named tutorial.d) == Example == {{{ #!d import std.stdio; import std.string; //import std.file; //char[] actualFile = cast(char[])std.file.read("tutorial.d"); const char[] simulatedFile = "Line 1 one\n" "Line 2 two\n" "Line 3 three"; void main () { char[][] allLines = splitlines(simulatedFile); foreach (char[] curLine; allLines) { writef(curLine, " = "); char[][] allWordsInCurLine = split(curLine); foreach (char[] curWord; allWordsInCurLine) { writef('[', curWord, ']', ' '); } writefln(); } } }}} == Source == || Link || http://www.dsource.org/tutorials/index.php?show_example=120 || || Posted by || Lynn || || Date/Time || Fri Sep 24, 2004 3:15 pm ||