Files
harbour-core/harbour/contrib/hbmisc/tests/tsstrfmt.prg
Viktor Szakats 4d65e6f462 2008-06-12 17:57 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* 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"
2008-06-12 16:02:17 +00:00

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