comparison tango/example/text/token.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
1 /*******************************************************************************
2
3 Tokenize input from the console. There are a variety of handy
4 tokenizers in the tango.text package ~ this illustrates usage
5 of an iterator that recognizes quoted-strings within an input
6 array, and splits elements on a provided set of delimiters
7
8 *******************************************************************************/
9
10 import tango.io.Console;
11
12 import Text = tango.text.Util;
13
14 void main()
15 {
16 // flush the console output, since we have no newline present
17 Cout ("Please enter some space-separated tokens: ") ();
18
19 // create quote-aware iterator for handling space-delimited
20 // tokens from the console input
21 foreach (element; Text.quotes (Text.trim(Cin.get), " \t"))
22 Cout ("<") (element) ("> ");
23
24 Cout.newline;
25 }