一个一个取啊,然后判断每个取得的字符的ARC码是否在英文ARC码范围内,如果不在,默认为中文,保存下来就行了

解决方案 »

  1.   

    'Test example:Add a textbox(Text1) On the FormPrivate Function isChinese(ByVal asciiv As Integer) As Boolean
       If Len(Hex$(asciiv)) > 2 Then
          isChinese = True
       Else
          isChinese = False
       End If
    End FunctionPrivate Sub Form_Load()
        Dim strSource As String
        Dim strDestination As String
        Dim i As Integer
        Dim strSelect As String
        
        strSource = CStr(InputBox("Please input the source string:", "convert"))
        strDestination = ""
        strSelect = ""
        For i = 1 To Len(strSource)
            strSelect = Mid(strSource, i, 1)
            If isChinese(Asc(strSelect)) Then
                strDestination = strDestination + Mid(strSource, i, 1)
            End If
        Next i
        If strDestination = "" Then
            MsgBox "没有中文字符!"
        Else
            Text1.Text = strDestination
        End If
    End Sub
      

  2.   

    我觉得ascii好像比较行吧
      

  3.   

    我找到了一个比较简单的方法,VB的字符串是unicode格式的,一个中文字符为一个字节,ascii则是2各字节。len(字符串)=3,lenb(strconv("字符串",vbformunicode))=6.两者相减大于0则有中文字符串,但无法判断中文字符的位置。
      

  4.   

    asc("char")<0 是一个Unicode字符但不一定是中文如韩文等双字节文字为True