Changeset 129
- Timestamp:
- 08/17/07 23:20:02 (1 year ago)
- Files:
-
- misc/opttest_tango.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
misc/opttest_tango.d
r99 r129 1 module opttest_tango; 2 1 3 //import std.stdio : Stdout.formatln; 2 4 import tango.io.Stdout : Stdout; 3 import tango.text.convert.Format : Format; 5 import tango.text.convert.Layout : Layout; 6 import tango.text.Util : join; 4 7 5 8 import optparse; 6 9 7 Format!(char) format; 10 Layout!(char) layout; 11 12 char[] format(T)(T t) { 13 return layout.convert("{0}", t); 14 } 8 15 9 16 char[] format_arr(T)(T[] arr) { 10 char[] result = "[";17 char[][] result = new char[][](arr.length); 11 18 foreach (i, s; arr) { 12 result ~= format("{0}",s);13 if (i != arr.length-1) result ~= ",";19 result[i] = format(s); 20 //if (i != arr.length-1) result ~= ","; 14 21 } 15 result ~= "]";16 return result;22 //result ~= "]"; 23 return "[" ~ join(result, ",") ~ "]"; 17 24 } 18 25 … … 28 35 29 36 int main(char[][] args) { 30 format = new Format!(char);37 layout = new Layout!(char); 31 38 //Stdout.println(format_arr(args)); 32 39 auto parser = new OptionParser("A test suite for optparser.");
