* contrib/hbmisc/strfmt.c
+ contrib/hbmisc/tests/tsstrfmt.prg
+ StrFormat() extended to automatically convert parameters
to strings, above that the result will AllTrim()-med too
before being inserted into the mask string:
StrFormat( "%2 %1 born on %3", "Smith", "Mr.", Date() ) ->
"Mr. Smith born on 06/12/08"
18 lines
492 B
Plaintext
18 lines
492 B
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
PROCEDURE Main()
|
|
|
|
? StrFormat( "%1 thing %2", "a", "b" )
|
|
? StrFormat( "%1 thing %2", "a", Date() )
|
|
? StrFormat( "%1 thing %2", .T., Date() )
|
|
? StrFormat( "%1 thing %2", .T., NIL )
|
|
? StrFormat( "%1 thing %2", "space1 ", 100.20 )
|
|
? StrFormat( "%1 thing %2", " space2 ", 213 )
|
|
? StrFormat( "%1 thing %2", " space3", 0.12 )
|
|
? StrFormat( "%2 thing %1 stuff", " space3", 0.12 )
|
|
? StrFormat( "%2 %1 born on %3", "Smith", "Mr.", Date() )
|
|
|
|
RETURN
|