看看下边的函数 也许对你有帮助 Private Function trueLeng(ByVal thisString As String) As Integer trueLeng = 0 Dim i As Integer Dim Max As Integer = thisString.Length For i = 0 To Max - 1 Step 1 If AscW(thisString.Substring(i, 1)) > 127 Then trueLeng += 2 Else trueLeng += 1 End If Next End Function
int length=b.Length;//=2
{
byte[] bl = System.Text.Encoding.Default.GetBytes(queryString);
return bl.Length;
}
Private Function trueLeng(ByVal thisString As String) As Integer
trueLeng = 0
Dim i As Integer
Dim Max As Integer = thisString.Length
For i = 0 To Max - 1 Step 1
If AscW(thisString.Substring(i, 1)) > 127 Then
trueLeng += 2
Else
trueLeng += 1
End If
Next
End Function