Skip to content

@technobuddha > library > Math > Roman Numerals

Function: romanize()

ts
function romanize(input: number, options: RomanOptions): string;

Defined in: romanize.ts:32

Convert a number into a roman numeral string

Parameters

ParameterTypeDescription
inputnumberThe number to turn into a roman numeral
optionsRomanOptionssee RomanOptions

Returns

string

Converted roman numeral

Example

typescript
toRoman(1); // "I"
toRoman(4); // "IV"
toRoman(9); // "IX"
toRoman(2024); // "MMXXIV"
toRoman(49, { format: 'apostrophus' }); // "IL"