Creation Reason
The simplified conversion of Chinese is a very common requirement.
But a lot of tool classes are simply mapping. (Use Map, collection, properties) and so on.
There is a serious problem: there may be a problem with the conversion of special phrases .
Opencc
OPENCC is a very good conversion tool. However, there are no direct Java-friendly jars available.
Opencc4j
OPENCC4J is the Java usage version provided on top of the tools above.
opencc4j How to use Maven to introduce
<dependency> <groupId>com.github.houbb</groupId> <artifactId>opencc4j</artifactId> <version>1.0.2</version></dependency>
Convert to Simplified
String original = "生命不息,奮鬥不止";String result = ZhConverterUtil.convertToSimple(original);
Result is
生命不息,奋斗不止
Convert to Traditional
String original = "生命不息,奋斗不止";String result = ZhConverterUtil.convertToTraditional(original);
Result is
生命不息,奮鬥不止
Java Chinese Simplified conversion tool opencc4j