BIS fnc ordinalNumber: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "code>_([a-zA-Z0-9_]+) = " to "code>private _$1 = ")
m (Text replacement - "<code>\[\[private\]\] (_?[a-zA-Z0-9_]+) = \[([^\[]*)\] \[\[(call|spawn)\]\] \[\[(BI(N|S)_fnc_[a-zA-Z0-9_]+)\]\];? \{\{cc\|([^ ]+)\}\}<\/code>" to "<sqf>private $1 = [$2] $3 $4; // $6</sqf>")
Line 18: Line 18:
|r1= [[String]]
|r1= [[String]]


|x1= <code>[[private]] _second = [42] [[call]] [[BIS_fnc_ordinalNumber]]; {{cc|will return "42nd" for English-speaking players}}</code>
|x1= <sqf>private _second = [42] call BIS_fnc_ordinalNumber; // will return "42nd" for English-speaking players</sqf>


|x2= <code>[[private]] _num1enm = [1, "English", [[false]]] [[call]] [[BIS_fnc_ordinalNumber]]; {{cc|returns "1st"}}
|x2= <code>[[private]] _num1enm = [1, "English", [[false]]] [[call]] [[BIS_fnc_ordinalNumber]]; {{cc|returns "1st"}}
Line 32: Line 32:
_num9en = [9, "English"] [[call]] [[BIS_fnc_ordinalNumber]]; {{cc|returns "9th"}}</code>
_num9en = [9, "English"] [[call]] [[BIS_fnc_ordinalNumber]]; {{cc|returns "9th"}}</code>


|x4= <code>[[private]] _second = [1, "unknownLanguage"] [[call]] [[BIS_fnc_ordinalNumber]]; {{cc|will return "1." if language is not recognised/supported}}</code>
|x4= <sqf>private _second = [1, "unknownLanguage"] call BIS_fnc_ordinalNumber; // will return "1." if language is not recognised/supported</sqf>


|seealso= [[language]]
|seealso= [[language]]
}}
}}

Revision as of 13:38, 1 July 2022

Hover & click on the images for description

Description

Description:
Return number as ordinal number (e.g. 1 become "1st")
Execution:
call
Groups:
Strings

Syntax

Syntax:
[number, language, isFeminine] call BIS_fnc_ordinalNumber
Parameters:
number: Number
language: String - (Optional, current game language)
isFeminine: Boolean - (Optional, default false)
Return Value:
String

Examples

Example 1:
private _second = [42] call BIS_fnc_ordinalNumber; // will return "42nd" for English-speaking players
Example 2:
private _num1enm = [1, "English", false] call BIS_fnc_ordinalNumber; // returns "1st" _num1frm = [1, "French",  false] call BIS_fnc_ordinalNumber; // returns "1er" _num1frw = [1, "French",   true] call BIS_fnc_ordinalNumber; // returns "1re" _num1esm = [1, "Spanish", false] call BIS_fnc_ordinalNumber; // returns "1" _num1esw = [1, "Spanish",  true] call BIS_fnc_ordinalNumber; // returns "1*" for Portuguese, Italian and Spanish
Example 3:
private _num1en = [1, "English"] call BIS_fnc_ordinalNumber; // returns "1st" _num2en = [2, "English"] call BIS_fnc_ordinalNumber; // returns "2nd" _num3en = [3, "English"] call BIS_fnc_ordinalNumber; // returns "3rd" _num4en = [4, "English"] call BIS_fnc_ordinalNumber; // returns "4th" _num9en = [9, "English"] call BIS_fnc_ordinalNumber; // returns "9th"
Example 4:
private _second = [1, "unknownLanguage"] call BIS_fnc_ordinalNumber; // will return "1." if language is not recognised/supported

Additional Information

See also:
language

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