| Function | Defined by | ||
|---|---|---|---|
|
printf(raw:String, ... rest):String
Creates a string with variable substitutions.
| br.com.stimuli.string | ||
| printf | () | function |
public function printf(raw:String, ... rest):StringCreates a string with variable substitutions. Very similiar to printf, specially python's printf
Parametersraw:String — The string to be substituted.
|
|
... rest — The objects to be substitued, can be positional or by properties inside the object (in wich case only one object can be passed)
|
String — The formated and substitued string.
|
See also
import br.com.stimuli.string.printf;
// objects are substitued in the other they appear
printf("This is an %s lybrary for creating %s", "Actioscript 3.0", "strings");
// outputs: "This is an Actioscript 3.0 lybrary for creating strings";
// you can also format numbers:
printf("You can also display numbers like PI: %f, and format them to a fixed precision, such as PI with 3 decimal places %.3f", Math.PI, Math.PI);
// outputs: " You can also display numbers like PI: 3.141592653589793, and format them to a fixed precision, such as PI with 3 decimal places 3.142"
// Instead of positional (the order of arguments to print f, you can also use propertie of an object):
var userInfo : Object = {
"name": "Arthur Debert",
"email": "arthur