如何将字符串转换为Unicode(代码点) [英] How to Convert String to Unicode (code point)

查看:328
本文介绍了如何将字符串转换为Unicode(代码点)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将阿拉伯字符串转换为Unicode,但像这样的字符串中的foreach字符就像下面的示例一样

示例:首先对字符unicode进行编码,然后如果unicode中的char是("\ u0639"),那么我只想取(0639)

我尝试这样做:

i need to convert a Arabic String into Unicode but like this foreach character in string do like the example below

example: first encode character unicode then if char in unicode is("\u0639") then i want to take only (0639)

i have tried to do this:

UnicodeEncoding unicode =new  UnicodeEncoding();
         byte[] unicodeBytes = unicode.GetBytes(text);
         var hex = BitConverter.ToUInt16(unicodeBytes,0);


我该怎么做.. ?? !!


How can i do that ..??!!

推荐答案

byte[] bytes = Encoding.Unicode.GetBytes("string here");


这篇关于如何将字符串转换为Unicode(代码点)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆