. . Hong Kong Business Software Company
Expert in web-based solutions
Software House in Hong Kong

Microsoft Certified Solution Developer

 

Chief Architect's Blog on software development

13 Febuary 2009
Determine Double-byte Character Input by Program
In computer, English can be represented by ASCII which is single byte. However, Chinese (also Japanese, Korea and many others) characters can only be represented by double byte. The following VB.Net function helps you to check whether your user is inputing ASCII or not.
   Private Function isASCII(ByVal str As String) As Boolean
   
        Dim i, j As Integer
        For i = 0 To str.Length - 1
            j = Asc(str(i))
            If Not Chr(j) = str(i) Then
                Return False
            End If
        Next
        Return True
    End Function