您的位置:首页 > 其它

判断字符串长度

2009-01-05 10:14 197 查看
static void Main(string[] args)
{
string a = "abcdefg";
string b = "abcdefg中华人民共和国";
Console.WriteLine(System.Text.Encoding.Default.GetBytes(a).Length);
Console.WriteLine(System.Text.Encoding.Default.GetBytes(b).Length);
}

输出:

7

21
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: