format: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Reverted edits by Heecf..... (talk) to last revision by Str) |
||
Line 1: | Line 1: | ||
{{Command|= Comments | |||
____________________________________________________________________________________________ | |||
| ofp |= Game name | |||
|1.00|= Game version | |||
____________________________________________________________________________________________ | |||
| Composes a string containing other variables or other variable types. | |||
Converts any variable type to a string. | |||
If you want to convert a string back to a number, use [[parseNumber]].|= Description | |||
____________________________________________________________________________________________ | |||
| [[String]] <nowiki>=</nowiki> '''format''' [formatString, var1, var2 ...] |= Syntax | |||
|p1= [formatString, var1, var2 ...]: [[Array]] |= Parameter 1 | |||
|p2= formatString: [[String]] - a string containing text and/or references to the variables listed below in the array. The references appear in the form of %1, %2 etc. |= Parameter 2 | |||
|p3= var1: [[Any Value]] - variable referenced by %1 |= Parameter 3 | |||
|p4= var2: [[Any Value]] - variable referenced by %2 |= Parameter 4 | |||
|p5= ......And so on. | |||
| [[String]] - | |||
The full string is returned. |= Return value | |||
____________________________________________________________________________________________ | |||
|x1= <pre>format ["Player:%1, player's side:%2",player,side player]</pre> | |||
returns "Player:WEST 1-1-A:1 (Username), player's side:WEST" |= Example 1 | |||
____________________________________________________________________________________________ | |||
| |= See also | |||
}} | |||
<h3 style="display:none">Notes</h3> | |||
<dl class="command_description"> | |||
<!-- Note Section BEGIN --> | |||
<dd class="notedate"> | |||
<dt class="note">'''Unknown'''<dd class="note">The format command is very strong in combination with [[call]]. Dynamic code can be created using format and then executed with call. | |||
<dt class="note">'''[[User:Worldeater|Worldeater]]'''<dd class="note"> | |||
The maximum number of characters returned by the ''format'' command seems to depend on the total byte count. For plain ASCII strings the limit is 2048 characters. | |||
<!-- Note Section END --> | |||
</dl> | |||
<h3 style="display:none">Bottom Section</h3> | |||
[[Category:Scripting Commands|FORMAT]] | |||
[[Category:Scripting Commands OFP 1.96|FORMAT]] | |||
[[Category:Scripting Commands OFP 1.46|FORMAT]] | |||
[[Category:Scripting Commands ArmA|FORMAT]] | |||
[[Category:Command_Group:_Interaction|{{uc:{{PAGENAME}}}}]] | |||
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]] | |||
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]] | |||
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | |||
Revision as of 00:19, 21 August 2012
Description
- Description:
- Composes a string containing other variables or other variable types. Converts any variable type to a string. If you want to convert a string back to a number, use parseNumber.
- Groups:
- Uncategorised
Syntax
- Syntax:
- String = format [formatString, var1, var2 ...]
- Parameters:
- [formatString, var1, var2 ...]: Array
- formatString: String - a string containing text and/or references to the variables listed below in the array. The references appear in the form of %1, %2 etc.
- var1: Any Value - variable referenced by %1
- var2: Any Value - variable referenced by %2
- ......And so on.
- Return Value:
- String - The full string is returned.
Examples
- Example 1:
format ["Player:%1, player's side:%2",player,side player]
returns "Player:WEST 1-1-A:1 (Username), player's side:WEST"
Additional Information
- See also:
- See also needed
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Unknown
- The format command is very strong in combination with call. Dynamic code can be created using format and then executed with call.
- Worldeater
- The maximum number of characters returned by the format command seems to depend on the total byte count. For plain ASCII strings the limit is 2048 characters.
Bottom Section
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.00
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.46
- Scripting Commands ArmA
- Command Group: Interaction
- Command Group: Variables
- Scripting Commands ArmA2
- Scripting Commands Take On Helicopters