VB 转 C#
dim temStr
tempStr = "abcdefghijk "
StrConv(Left(StrConv(temStr, vbFromUnicode), 4), vbUnicode)
'他将返回 "abcdefgh "
tempStr = "中华人民共和国 "
StrConv(Left(StrConv(temStr, vbFromUnicode), 4), vbUnicode)
'他将返回 "中华人民 "
先求助把它转换成C#
------解决方案--------------------string tempStr;
byte[] vBytes;
tempStr = "abcdefghijk ";
vBytes = Encoding.Default.GetBytes(tempStr);
MessageBox.Show(Encoding.Default.GetString(vBytes, 0, 4 * 2));
tempStr = "中华人民共和国 ";
vBytes = Encoding.Default.GetBytes(tempStr);
MessageBox.Show(Encoding.Default.GetString(vBytes, 0, 4 * 2));