Разговор о модулу:ConvertNumeric
numeral_to_english[уреди извор]
Converts a given integer to its English text representation. Accepts integers (including negative and zero), decimal numbers, and scientific notation. Any value not matching these is evaluated as an expression and the result is used. Any value with magnitude less than 1000 quadragintillion (10126) is supported, as well as some larger numbers such as one centillion (10303) and one millinillion (103003).
Examples[уреди извор]
{{#invoke:ConvertNumeric | numeral_to_english | -123456789.25 }}
- negative one hundred twenty-three million four hundred fifty-six thousand seven hundred and eighty-nine point two five
{{#invoke:ConvertNumeric | numeral_to_english | 5E30 | case=u | ord=on | lk=on }}
- Five nonillionth
{{#invoke:ConvertNumeric | numeral_to_english | 57000 | round=on | plural=on}}
- sixty thousands
{{#invoke:ConvertNumeric | numeral_to_english | 35 + 42 | adj=on }}
- seventy-seven
{{#invoke:ConvertNumeric | numeral_to_english | 3+1/2 }}
- three point five
{{#invoke:ConvertNumeric | numeral_to_english | 3 | numerator = 1 | denominator = 2 }}
- three and a half
Optional parameters[уреди извор]
- numerator
- denominator
- both necessary for fractions
- case
- Set to "U" or "u" to capitalize result
- sp
- Set to "us" to remove "and" between hundreds and tens places
- adj
- Hyphenate
- ord
- Ordinal (e.g. first instead of one)
- pl
- Plural
- lk
- If set to 'on', will link the words "billion" and larger to their respective short-scale article sections. This might be helpful for disambiguation. Subsets of words can be linked to by specifying them, e.g. lk=trillion will link only "trillion", and lk=trillion,quadrillion will link only those two.
- negative
- Sets the word to use for negative if the supplied value is negative (e.g. negative or minus)
- round
- If set to 'on', will round the number to the nearest one- or two-word integer. |round=down and |round=up are similar but round down and up respectively.
decToHex[уреди извор]
This takes a string and converts all the decimal sequences in it to hex.
{{#invoke:ConvertNumeric|decToHex|10 20 40 1024 78912345|minlength=4}}
produces
000A 0014 0028 0400 4B41B59
roman_to_numeral[уреди извор]
Hi, I wanted to use this function in a module I'm working on (Module:Sandbox/Bility/SortName), but it doesn't appear to be exposed publicly. Is that right, or could I just not figure out how to access it using require ('Module:ConvertNumeric')
? For now I've copy/pasted it into my module. — Bility (talk) 22:23, 11 April 2013 (UTC)