Axaptapedia is now maintained by AgileCadence For more information please click here.

StrFmt

From Axaptapedia
Jump to: navigation, search

StrFmt[edit]

Syntax[edit]

<xpp> str StrFmt(str string, ...) </xpp>

Description[edit]

Formats the text string specified by string and substitutes any %n occurences with the nth argument.

Note[edit]

If you do not supply additional arguments for the used %n’s, the string will keep the %n for which argument was missing.

Example[edit]

<xpp> StrFmt("The next %1 is %2.", "task", "easy"); //Returns the string “The next task is easy."

StrFmt("The next %1 is %2.", "error"); //Returns the string "The next error is %2." because of the missing argument for %2. </xpp> <xpp> date d = str2date("2006-05-16", 321); int i = 123; real r = 32.2; str s = "foo";

strFmt("%1", d); //returns the text string "2006-05-16".

strFmt("%1", i); //returns the text string "123".

strFmt("%1", r); //returns the text string "32,20".

strFmt("%1", s); //returns the text string "foo". </xpp>

See also[edit]