strFmt Function

Formats a string and substitutes any occurrences of %n with the nth argument.


str strFmt(str _string, ...)

Parameter

Description

_string

The string (one or more) to be formatted.

The formatted string.

If an argument is not provided for a parameter, it will be returned as "%n" in the string. For example, strFmt("The next %1 is %2.","error"); returns "The next error is %2." due to the missing argument for %2.

static void strFmtExample(Args _arg)
{
   real r = 3.14;
   int  i = 42;
   str  s;
   ;
   s = strFmt("Real = %1, Int = %2", r, i);
   print s;
 
   pause;
    }

Community Additions

ADD
Show: