Changes from Version 1 of TokenExample
- Timestamp:
- 04/17/07 01:57:47 (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TokenExample
v0 v1 1 {{{ 2 #!d 3 /******************************************************************************* 4 5 Tokenize input from the console. There are a variety of handy 6 tokenizers in the tango.text package ~ this illustrates usage 7 of an iterator that recognizes quoted-strings within an input 8 array, and splits elements on a provided set of delimiters 9 10 *******************************************************************************/ 11 12 import tango.io.Console; 13 14 import Text = tango.text.Util; 15 16 void main() 17 { 18 // flush the console output, since we have no newline present 19 Cout ("Please enter some space-separated tokens: ") (); 20 21 // create quote-aware iterator for handling space-delimited 22 // tokens from the console input 23 foreach (element; Text.quotes (Text.trim(Cin.get), " \t")) 24 Cout ("<") (element) ("> "); 25 26 Cout.newline; 27 } 28 }}}