Format: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:
<pre>
<pre>
Print Format("1{0}2","a")
Print Format("1{0}2","a")
Print Format("My name is {0} and I live in {1}.", "Kartman", "South Park")
Print Format("My name is {0} and I live in {1}.", "Cartman", "South Park")
</pre>
</pre>


== Example (JavaScript) ==
== Example (JavaScript) ==
<pre>
<pre>
NSB.Print(FormatCurrency(-3.5, 2, 0, true));
Print(Format("1{0}2","a"));
NSB.Print(FormatCurrency(123456, 2, true, false, true));
Print(Format("My name is {0} and I live in {1}.", "Cartman", "South Park"));
</pre>
</pre>


Line 20: Line 20:
<pre>
<pre>
1a2
1a2
My name is Kartman and I live in South Park.
My name is Cartman and I live in South Park.
</pre>
</pre>



Revision as of 16:39, 2 April 2014

Format(string, replace0[,replace1...])

Description

Replaces {n} placeholders with arguments. One or more arguments can be passed, in addition to the string template itself, to insert into the string.

Example (Basic)

Print Format("1{0}2","a")
Print Format("My name is {0} and I live in {1}.", "Cartman", "South Park")

Example (JavaScript)

Print(Format("1{0}2","a"));
Print(Format("My name is {0} and I live in {1}.", "Cartman", "South Park"));

Output

1a2
My name is Cartman and I live in South Park.