Changeset 129

Show
Ignore:
Timestamp:
08/17/07 23:20:02 (1 year ago)
Author:
KirkMcDonald
Message:

Updated opttest_tango.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • misc/opttest_tango.d

    r99 r129  
     1module opttest_tango; 
     2 
    13//import std.stdio : Stdout.formatln; 
    24import tango.io.Stdout : Stdout; 
    3 import tango.text.convert.Format : Format; 
     5import tango.text.convert.Layout : Layout; 
     6import tango.text.Util : join; 
    47 
    58import optparse; 
    69 
    7 Format!(char) format; 
     10Layout!(char) layout; 
     11 
     12char[] format(T)(T t) { 
     13    return layout.convert("{0}", t); 
     14
    815 
    916char[] format_arr(T)(T[] arr) { 
    10     char[] result = "["
     17    char[][] result = new char[][](arr.length)
    1118    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 ~= ","; 
    1421    } 
    15     result ~= "]"; 
    16     return result
     22    //result ~= "]"; 
     23    return "[" ~ join(result, ",") ~ "]"
    1724} 
    1825 
     
    2835 
    2936int main(char[][] args) { 
    30     format = new Format!(char); 
     37    layout = new Layout!(char); 
    3138    //Stdout.println(format_arr(args)); 
    3239    auto parser = new OptionParser("A test suite for optparser.");