BIS fnc romanNumeral: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|= Comments" to "|Comments=")
m (Some wiki formatting)
 
(40 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|Comments=
|game1= arma3
____________________________________________________________________________________________
|version1= 1.00


| arma3 |= Game name
|gr1= Strings


|1.00|= Game version
|gr2= Math
____________________________________________________________________________________________


| Convert integer to roman numeral (e.g. 42 becomes "XLII").|DESCRIPTION=
|descr= Convert integer to roman numerals (e.g. 42 becomes "XLII").
____________________________________________________________________________________________


| integer [[call]] '''BIS_fnc_romanNumeral'''; |SYNTAX=
|s1= integer call [[BIS_fnc_romanNumeral]]


|p1= '''integer:''': [[Integer]] - Any integer between 1 and 3999. |= paramter 1
|p1= integer: [[Number]], [[String]], [[Code]] or [[Config]], same as [[BIS_fnc_parseNumber]] (used in this function) - any '''integer''' between 1 and 3999


|r1= [[String]] - roman numerals


| [[String]] - Roman number |RETURNVALUE=
|x1= <sqf>
____________________________________________________________________________________________
1 call BIS_fnc_romanNumeral; // returns "I"
2035 call BIS_fnc_romanNumeral; // returns "MMXXXV"
3999 call BIS_fnc_romanNumeral; // returns "MMMCMXCIX"
</sqf>


|x1= <code>1 [[call]] '''BIS_fnc_romanNumerald'''; //Returns "I"</code> |EXAMPLE1=
|seealso= [[BIS_fnc_ordinalNumber]] [[BIS_fnc_phoneticalWord]]
|x2= <code>3999 [[call]] '''BIS_fnc_romanNumerald'''; //Returns "MMMCMXCIX"</code> |EXAMPLE1=
}}


____________________________________________________________________________________________
{{Note
|user= Lou Montana
|timestamp= 20191001014600
|text= A Roman numeral is read like this:
<!--
these are ASCII Roman Numerals, but let's not use them in order to avoid copy-paste confusion :^)
Ⅰ Ⅴ Ⅹ Ⅼ Ⅽ Ⅾ Ⅿ
-->
{{{!}} class="wikitable align-center"
{{!}}- style="font-family: serif"
! style="font-family: sans-serif" {{!}} Numeral
{{!}} I {{!}}{{!}} V {{!}}{{!}} X {{!}}{{!}} L {{!}}{{!}} C {{!}}{{!}} D {{!}}{{!}} M
{{!}}-
! Value
{{!}} 1 {{!}}{{!}} 5 {{!}}{{!}} 10 {{!}}{{!}} 50 {{!}}{{!}} 100 {{!}}{{!}} 500 {{!}}{{!}} 1000
{{!}}}


| [[BIS_fnc_ordinalNumber]], [[BIS_fnc_phoneticalWord]]|SEEALSO=
* It is read from left to right from the biggest numeral to the lowest*, adding up:<br><small>* not entirely true, see subtractions below</small>
** {{hl|DCLVII}} = {{hl|D}} → {{hl|C}} → {{hl|L}} → {{hl|V}} → {{hl|I}} → {{hl|I}} = 500 + 100 + 50 + 5 + 1 + 1 = 657
* A subtraction is done by writing '''one''' smaller numeral before a big one:
** 9 could be written {{hl|VIIII}}, or {{hl|IX}}: 1 and 10, meaning 10 - 1 = 9 / but {{hl|IIX}} for 8 does not exist, only {{hl|VIII}}
* The same numeral can be put together multiple times, but ''usually'' (there is no standard, but the shorter version is usually preferred) up to the point where it can be subtracted from the numeral above the used one (subtraction still done with only '''one''' numeral):
** {{hl|IIII}} = {{hl|IV}}, {{hl|CCCC}} = {{hl|CD}}


Now let's see if you can translate this one: {{hl|MCMLXXXV}}. Tip: where it all started ;-) <small><small>{{hl|MCMLXXXII}} for the purists!</small></small><br>
To learn more: '''{{Link|https://en.wikipedia.org/wiki/Roman_numerals|Roman numerals on wikipedia}}'''
}}
}}
<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:romanNumeral}}]]
[[Category:Functions|{{uc:romanNumeral}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:romanNumeral}}]]

Latest revision as of 17:49, 12 May 2023

Hover & click on the images for description

Description

Description:
Convert integer to roman numerals (e.g. 42 becomes "XLII").
Execution:
call
Groups:
StringsMath

Syntax

Syntax:
integer call BIS_fnc_romanNumeral
Parameters:
integer: Number, String, Code or Config, same as BIS_fnc_parseNumber (used in this function) - any integer between 1 and 3999
Return Value:
String - roman numerals

Examples

Example 1:
1 call BIS_fnc_romanNumeral; // returns "I" 2035 call BIS_fnc_romanNumeral; // returns "MMXXXV" 3999 call BIS_fnc_romanNumeral; // returns "MMMCMXCIX"

Additional Information

See also:
BIS_fnc_ordinalNumber BIS_fnc_phoneticalWord

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
Lou Montana - c
Posted on Oct 01, 2019 - 01:46 (UTC)
A Roman numeral is read like this:
Numeral I V X L C D M
Value 1 5 10 50 100 500 1000
  • It is read from left to right from the biggest numeral to the lowest*, adding up:
    * not entirely true, see subtractions below
    • DCLVII = DCLVII = 500 + 100 + 50 + 5 + 1 + 1 = 657
  • A subtraction is done by writing one smaller numeral before a big one:
    • 9 could be written VIIII, or IX: 1 and 10, meaning 10 - 1 = 9 / but IIX for 8 does not exist, only VIII
  • The same numeral can be put together multiple times, but usually (there is no standard, but the shorter version is usually preferred) up to the point where it can be subtracted from the numeral above the used one (subtraction still done with only one numeral):
    • IIII = IV, CCCC = CD

Now let's see if you can translate this one: MCMLXXXV. Tip: where it all started ;-) MCMLXXXII for the purists!
To learn more: Roman numerals on wikipedia