if AscB(char1) > 127 then
   stringlen +=1
end if

解决方案 »

  1.   

    byte[]  b = System.Text.Encoding.Default.GetBytes("国");
    int length=b.Length;//=2
      

  2.   

    private static int GetContentLength(string queryString)
      {
       byte[] bl = System.Text.Encoding.Default.GetBytes(queryString);
       return bl.Length;
      }
      

  3.   

    看看下边的函数 也许对你有帮助
        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