简体   繁体   中英

java.text.Normalizer equivalent for Java ME (to replace accented characters)

I would like to know if there exists a class or library for Java ME that emulates what java.text.Normalizer does.

I want to be able to replace accented characters with non-accented versions of the same characters (in Portuguese). Eg: "coração" ===> "coracao".

Using Normalizer class, it would be:

Normalizer.normalize(string, Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "")

I want to be able to replace accented characters in the most efficient manner possible in Java ME.

icu4j is IBM's effort on internationalisation. The package com.ibm.icu.text seems to be where your functionality can be found. For Java ME you would probably need to prune the library, as it is large (because of its full unicode and all languages nature). You might use a code obfuscator for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM