简体   繁体   English

java.text.Normalizer等效于Java ME(替换重音字符)

[英]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. 我想知道是否存在Java ME的类或库,它模拟java.text.Normalizer所做的事情。

I want to be able to replace accented characters with non-accented versions of the same characters (in Portuguese). 我希望能够用相同字符的非重音版本替换重音字符(用葡萄牙语)。 Eg: "coração" ===> "coracao". 例如:“coração”===>“coracao”。

Using Normalizer class, it would be: 使用Normalizer类,它将是:

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. 我希望能够在Java ME中以最有效的方式替换重音字符。

icu4j is IBM's effort on internationalisation. icu4j是IBM在国际化方面的努力。 The package com.ibm.icu.text seems to be where your functionality can be found. com.ibm.icu.text包似乎是您可以找到您的功能的地方。 For Java ME you would probably need to prune the library, as it is large (because of its full unicode and all languages nature). 对于Java ME,您可能需要修剪库,因为它很大(因为它具有完整的unicode和所有语言性质)。 You might use a code obfuscator for that. 您可以使用代码混淆器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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