Although it is estimated that this will not be used in the future, I still feel that it should be stored.
From http://blog.csdn.net/jasonzhou613/article/details/9194597
Simple and traditional conversion, first we want to introduce a package: jcc-bate-0.7.3.jar.
Let's first look at the structure of this package:
As shown in the figure, you can obtain an instance through jchineseconvertor. getinstance (); and then convert the instance using the s2t and T2S methods.
The s2t method converts simplified to traditional Chinese, and the T2S method converts traditional to simplified.
[Java]View
Plaincopy
- // Convert simplified to traditional
- Public String change (string changetext ){
- Try {
- Jchineseconvertor = jchineseconvertor
- . Getinstance ();
- Changetext = jchineseconvertor. s2t (changetext );
- } Catch (ioexception e ){
- E. printstacktrace ();
- }
- Return changetext;
- }
- // Convert traditional Chinese to simplified Chinese
- Public String change1 (String changeText ){
- Try {
- JChineseConvertor jChineseConvertor = JChineseConvertor
- . GetInstance ();
- ChangeText = jChineseConvertor. t2s (changeText );
- } Catch (IOException e ){
- E. printStackTrace ();
- }
- Return changeText;
- }
Jcc-bate-0.7.3.jar: Small