[NAME]
ALL.dao.type.string.method.expand

[TITLE]
expand( self :string )

[DESCRIPTION]


     
   1  expand( self :string, keys :map<string,string>, spec = '$', keep = 1 ) => string
     
If the string contains place holders in form of $(name), where $ is the special 
character passed in by spec, this method will expand or fill at each place holder by the
value string from keys with key equal to the name of the place holder.

If keep is zero, place holders with names not found in keys will be replaced by empty 
string, namely, removing the place holders; otherwise the are kept.
     
   1  tpl = 'The quick brown $(A) jumps over the lazy $(B)';
   2  str = tpl.expand( { 'A' => 'fox', 'B' => 'dog' } );
   3  io.writeln( str );
     



     
   1  expand( self :string, keys :tuple, spec = '$', keep = 1 ) => string
     
If the string contains place holders in form of $(name), where $ is the special 
character passed in by spec, this method will expand or fill at each place holder by the
item value string from keys with item field name equal to the name of the place holder.
If keep is zero, place holders with names not found in keys will be replaced by empty 
string, namely, removing the place holders; otherwise the are kept.
     
   1  tpl = 'The quick brown $(A) jumps over the lazy $(B)';
   2  str = tpl.expand( ( A => 'fox', B => 'dog' ) );
   3  io.writeln( str );