Android simplified and Traditional Chinese Conversion

Source: Internet
Author: User

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

  1. // Convert simplified to traditional
  2. Public String change (string changetext ){
  3. Try {
  4. Jchineseconvertor = jchineseconvertor
  5. . Getinstance ();
  6. Changetext = jchineseconvertor. s2t (changetext );
  7. } Catch (ioexception e ){
  8. E. printstacktrace ();
  9. }
  10. Return changetext;
  11. }
  12. // Convert traditional Chinese to simplified Chinese
  13. Public String change1 (String changeText ){
  14. Try {
  15. JChineseConvertor jChineseConvertor = JChineseConvertor
  16. . GetInstance ();
  17. ChangeText = jChineseConvertor. t2s (changeText );
  18. } Catch (IOException e ){
  19. E. printStackTrace ();
  20. }
  21. Return changeText;
  22. }

Jcc-bate-0.7.3.jar: Small


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.