Clib.rsprintf()
syntax: |
Clib.rsprintf(formatString[, variables ...]) |
where: |
formatString - string that specifies the final format.
variables - values to be converted to and formatted as a string.
|
return: |
string - formatted according to formatString using any variables passed.
|
description: |
This method returns a formatted string. It is similar to Clib.printf(), except that a string is returned instead of printed.
|
see: |
|
example: |
// If in a script you had a line:
Clib.printf("%s has seen %s %d times.\n", name, movie, timesSeen);
// and you wanted to pass the resulting string // as a parameter to a function, you could do it // as follows.
func(Clib.rsprintf("%s has seen %s %d times.\n", name, movie, timesSeen));
// The following lines of code achieve // the same result, that is, create // a string variable named word that contains // the string "Who is #1?".
var word word = Clib.rsprintf("Who is #%d?", 3-2); Clib.sprintf(word, "Who is #%d?", 3-2); |