/**
*
*/
package de.tutorials;
import java.util.Locale;
import com.ibm.icu.text.RuleBasedNumberFormat;
/**
* @author Tom
*
*/
public class ICUExample {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
String numberAsWordGer = "siebenundneunzig";
String numberAsWordUs = "ninety-seven";
int number = 97;
System.out.println(number
+ " -> "
+ new RuleBasedNumberFormat(RuleBasedNumberFormat.SPELLOUT)
.format(number));
System.out.println(new RuleBasedNumberFormat(
RuleBasedNumberFormat.SPELLOUT).parse(numberAsWordGer));
System.out.println(number
+ " -> "
+ new RuleBasedNumberFormat(Locale.ENGLISH,
RuleBasedNumberFormat.SPELLOUT).format(number));
System.out.println(new RuleBasedNumberFormat(Locale.ENGLISH,
RuleBasedNumberFormat.SPELLOUT).parse(numberAsWordUs));
}
}