BIS fnc ordinalNumber: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
m (Fix SQF)
 
(36 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 1.00


|1.00|= Game version
|gr1= Strings
____________________________________________________________________________________________


| Return number as ordinal number (e.g. 1 become "1st") |DESCRIPTION=
|descr= Return number as ordinal number (e.g. 1 become "1st")
____________________________________________________________________________________________


| [number, language, isFeminine] call [[BIS_fnc_ordinalNumber]] |SYNTAX=
|s1= [number, language, isFeminine] call [[BIS_fnc_ordinalNumber]]


|p1= number: [[Number]] |PARAMETER1=
|p1= number: [[Number]]


|p2= language: [[String]] - (Optional, current game [[language]]) |PARAMETER2=
|p2= language: [[String]] - (Optional, current game [[language]])


|p3= isFeminine: [[Boolean]] - (Optional, default [[false]]) |PARAMETER3=
|p3= isFeminine: [[Boolean]] - (Optional, default [[false]])


| [[String]] |RETURNVALUE=
|r1= [[String]]
____________________________________________________________________________________________


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


|x2= <code>_num1enm = [1, "English", [[false]]] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "1st"}}
|x2= <sqf>
_num1frm = [1, "French",&nbsp; [[false]]] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "1er"}}
private _num1enm = [1, "English", false] call BIS_fnc_ordinalNumber; // returns "1st"
_num1frw = [1, "French",&nbsp; &nbsp;[[true]]] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "1re"}}
_num1frm = [1, "French", false] call BIS_fnc_ordinalNumber; // returns "1er"
_num1esm = [1, "Spanish", [[false]]] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "1"}}
_num1frw = [1, "French",   true] call BIS_fnc_ordinalNumber; // returns "1re"
_num1esw = [1, "Spanish", &nbsp;[[true]]] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "1*" for Portuguese, Italian and Spanish}}</code> |EXAMPLE2=
_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
</sqf>


|x3= <code>_num1en = [1, "English"] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "1st"}}
|x3= <sqf>
_num1en = [2, "English"] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "2nd"}}
private _num1en = [1, "English"] call BIS_fnc_ordinalNumber; // returns "1st"
_num1en = [3, "English"] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "3rd"}}
_num2en = [2, "English"] call BIS_fnc_ordinalNumber; // returns "2nd"
_num1en = [4, "English"] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "4th"}}
_num3en = [3, "English"] call BIS_fnc_ordinalNumber; // returns "3rd"
_num1en = [9, "English"] [[call]] [[BIS_fnc_ordinalNumber]]; {{codecomment|// returns "9th"}}</code> |EXAMPLE3=
_num4en = [4, "English"] call BIS_fnc_ordinalNumber; // returns "4th"
_num9en = [9, "English"] call BIS_fnc_ordinalNumber; // returns "9th"
</sqf>


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


|seealso= [[language]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Strings|{{uc:ordinalNumber}}]]
[[Category:Functions|{{uc:ordinalNumber}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:ordinalNumber}}]]

Latest revision as of 16:47, 1 November 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