CharacterArray.st
changeset 7313 9be9b35f5370
parent 7312 d84ad62592c3
child 7318 cc7a8f38f696
equal deleted inserted replaced
7312:d84ad62592c3 7313:9be9b35f5370
  5291     "return a copy of the receiver, where all %i escapes are
  5291     "return a copy of the receiver, where all %i escapes are
  5292      replaced by corresponding arguments' printStrings from the argArrayOrDictionary.
  5292      replaced by corresponding arguments' printStrings from the argArrayOrDictionary.
  5293      I.e. 'hello %1; how is %2' expandPlaceholdersWith:#('world' 'this') results
  5293      I.e. 'hello %1; how is %2' expandPlaceholdersWith:#('world' 'this') results
  5294      in the new string 'hello world; how is this'.
  5294      in the new string 'hello world; how is this'.
  5295      As an extension, the argument may also be a dictionary, providing
  5295      As an extension, the argument may also be a dictionary, providing
  5296      values for character keys.
  5296      values for symbolic keys.
  5297      In this case, %a .. %z and %(...) are also allowed.
  5297      In this case, %a .. %z and %(...) are also allowed.
  5298      (%1..%9 require a numeric key in the dictionary, however)
  5298      (%1..%9 require a numeric key in the dictionary, however)
  5299      To get a '%' character, use a '%%'-escape.
  5299      To get a '%' character, use a '%%'-escape.
       
  5300      To get an integer-indexed placeHolder followed by another digit,
       
  5301      or an index > 9, you must use %(digit).
  5300      See also bindWith:... for VisualAge compatibility."
  5302      See also bindWith:... for VisualAge compatibility."
  5301 
  5303 
  5302     |expandedString next v key
  5304     |expandedString next v key
  5303      idx   "{ SmallInteger }"
  5305      idx   "{ SmallInteger }"
  5304      idx2  "{ SmallInteger }"
  5306      idx2  "{ SmallInteger }"
  5355     "
  5357     "
  5356      'hello %1' expandPlaceholdersWith:#('world') 
  5358      'hello %1' expandPlaceholdersWith:#('world') 
  5357      'hello %1; how is %2' expandPlaceholdersWith:#('world' 'this') 
  5359      'hello %1; how is %2' expandPlaceholdersWith:#('world' 'this') 
  5358      'hello %2; how is %1' expandPlaceholdersWith:#('world' 'this') 
  5360      'hello %2; how is %1' expandPlaceholdersWith:#('world' 'this') 
  5359      '%1 plus %2 gives %3 ' expandPlaceholdersWith:#(4 5 9) 
  5361      '%1 plus %2 gives %3 ' expandPlaceholdersWith:#(4 5 9) 
       
  5362      '%%(1)0 gives %(1)0' expandPlaceholdersWith:#(123) 
       
  5363      '%%10 gives %10' expandPlaceholdersWith:#(123)     
       
  5364      '%%(10) gives %(10)' expandPlaceholdersWith:#(123) 
  5360     "
  5365     "
  5361 
  5366 
  5362     "
  5367     "
  5363      |dict|
  5368      |dict|
  5364 
  5369 
  6393 ! !
  6398 ! !
  6394 
  6399 
  6395 !CharacterArray class methodsFor:'documentation'!
  6400 !CharacterArray class methodsFor:'documentation'!
  6396 
  6401 
  6397 version
  6402 version
  6398     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.247 2003-05-20 15:30:30 cg Exp $'
  6403     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.248 2003-05-20 15:35:43 cg Exp $'
  6399 ! !
  6404 ! !
  6400 
  6405 
  6401 CharacterArray initialize!
  6406 CharacterArray initialize!