在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public static String native2ascii(String str)
{ int code; char[] chars = str.ToCharArray(); StringBuilder sb = new StringBuilder(255); for (int i = 0; i < chars.Length; i++) { char c =chars[i]; if (c > 255) { sb.Append("\\u"); code = (c >> 8); string tmp = code.ToString("X"); if (tmp.Length == 1) sb.Append("0"); sb.Append(tmp); code = (c & 0xFF); tmp = code.ToString("X"); if (tmp.Length == 1) sb.Append("0"); sb.Append(tmp); } else { sb.Append(c); } } return (sb.ToString()); } |
请发表评论