Roman Number To Text - CSharp System

CSharp examples for System:String Number

Description

Roman Number To Text

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using System.Collections.Generic;
using System;/*w  ww  . jav a  2s .  com*/

public class Main{
        public static string RomanNumberToText(string romanNumber)
        {
            StringBuilder sb = new StringBuilder();
            String C3 = romanNumber.Trim();
            sb.Append(C3 + " ");
            String PosterName2 = sb.ToString().ToLower();
            C3 = PosterName2.Replace(" i ", " one ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" ii ", " two ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" iii ", " three ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" iv ", " four ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" v ", " five ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" vi ", " six ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" vii ", " seven ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" viii ", " eight ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" ix ", " nine ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" x ", " ten ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xi ", " eleven ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xii ", " tweleve ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xiii ", " thirteen ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xiv ", " fourteen ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xv ", " fifteen ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xvi ", " sixteen ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xvii ", " seventeen ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xviii ", " eightteen ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xix ", " nineteen ").ToLower();
            PosterName2 = C3;
            C3 = PosterName2.Replace(" xx ", " twenty ").ToLower();
            PosterName2 = C3.Trim();
            return PosterName2;
        }
}

Related Tutorials