Doing exercise from book, but I'm getting error with splitter

Sanios via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 16 09:38:13 PDT 2014


Hello guys, as first I don't know, if I'm writing to correct
section, but I've got a problem. I'm actually reading book of D
guide and trying to do it like it is in book.

My code is:

import std.stdio, std.string;

void main() {
	uint[string] dictionary;
	foreach (line; stdin.byLine()) {
		foreach (word; splitter(strip(line))) {
			if (word in dictionary) continue;
			auto newID = dictionary.length;
			dictionary[word] = newID;
			writeln(newID, '\t', word);
		}
	}
}

And I'm getting this - Error: undefined identifier splitter
It seems like std.string doesn't contain splitter.


More information about the Digitalmars-d-learn mailing list