Commit 780e8b2c authored by 张永's avatar 张永

增加简体转繁体方法

parent c24d76d9
...@@ -10,6 +10,22 @@ ...@@ -10,6 +10,22 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories>
<repository>
<id>my</id>
<name>my</name>
<url>http://123.157.244.130:9003/nexus/content/groups/public/</url>
</repository>
<repository>
<id>repo1</id>
<name>repo1</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<!-- <repository> <id>mvnrepository</id> <name>mvnrepository</name> <url>https://mvnrepository.com/</url>
</repository> -->
</repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
...@@ -120,6 +136,14 @@ ...@@ -120,6 +136,14 @@
<version>2.0.10</version> <version>2.0.10</version>
</dependency> </dependency>
<!-- 简体转繁体 -->
<dependency>
<groupId>com.github.houbb</groupId>
<artifactId>opencc4j</artifactId>
<version>1.8.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -31,12 +31,14 @@ import javax.crypto.spec.SecretKeySpec; ...@@ -31,12 +31,14 @@ import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.binary.Hex;
import org.springframework.util.Assert;
import com.egolm.common.exception.CharsetException; import com.egolm.common.exception.CharsetException;
import com.egolm.common.exception.MD5Exception; import com.egolm.common.exception.MD5Exception;
import com.egolm.common.exception.PluginException; import com.egolm.common.exception.PluginException;
import com.egolm.common.exception.ReflectException; import com.egolm.common.exception.ReflectException;
import com.egolm.common.exception.SHA1Exception; import com.egolm.common.exception.SHA1Exception;
import com.github.houbb.opencc4j.util.ZhConverterUtil;
import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
...@@ -1202,4 +1204,21 @@ public class StringUtil { ...@@ -1202,4 +1204,21 @@ public class StringUtil {
return stack; return stack;
} }
/**
* 简体中文转繁体
* https://www.jianshu.com/p/ebb471c39fb8
* <p>Title: </p>
* <p>Description: </p>
* @return
*/
public static String znChineseToTraditional(String znStr) {
return ZhConverterUtil.toTraditional(znStr);
}
public static void main(String[] args) {
String original = "综合平效-实面";
String result = ZhConverterUtil.toTraditional(original);
//Assert.assertEquals("生命不息,奮鬥不止", result);
System.out.println(result);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment