Unicode Char To String : Unicode « Development « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Development » Unicode 
Unicode Char To String
  
/*
 * Copyright (C) 2011 The LiteListen Project
 
 * Licensed under the Mozilla Public Licence, version 1.1 (the "License");
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 
 * ???? Mozilla Public Licence 1.1 ???????³?????????

 *
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 */

class Main {
  public static String UnicodeCharToString(char[] Char) {
    String strTemp = "";

    for (int i = 1; i < Char.length; i += 2) {
      String s1 = Integer.toHexString((intChar[i]);
      String s2 = Integer.toHexString((intChar[i - 1]);

      // ????????
      if (s1.length() == 1)
        s1 = "0" + s1;

      if (s2.length() == 1)
        s2 = "0" + s2;

      strTemp += s1 + s2;
    }

    return UnicodeToString(strTemp).trim();
  }

  public static String UnicodeToString(String Hex) {
    String enUnicode = null;
    String deUnicode = null;

    for (int i = 0; i < Hex.length(); i++) {
      if (enUnicode == null)
        enUnicode = String.valueOf(Hex.charAt(i));
      else
        enUnicode = enUnicode + Hex.charAt(i);

      if (i % == 3) {
        if (enUnicode != null) {
          if (deUnicode == null)
            deUnicode = String.valueOf((charInteger.valueOf(
                enUnicode, 16).intValue());
          else
            deUnicode = deUnicode
                + String.valueOf((charInteger.valueOf(
                    enUnicode, 16).intValue());
        }

        enUnicode = null;
      }
    }

    return deUnicode;
  }
}

   
    
  
Related examples in the same category
1.Unicode Chart
2.Convert to Unicode
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.