ClassMicrosoft.VisualBasic.Strings SyntaxDim result As Integer = Asc(string) Dim result As Integer = AscW(string)
DescriptionThe Asc and AscW functions return the character code for the first character of the string passed to them. All other characters in the string are ignored. The range for the returned value is 0 to 255 on Single Byte Character Set values, and 32768 to 32767 on Double Byte Character Set values. The AscW version always uses the larger range. Usage at a GlanceThe Asc version uses the active code page of the current thread; the AscW function always uses the general Unicode character set. ExampleDim charCode As Integer If Len(sampleString) > 0 Then charCode = Asc(sampleString) If (charCode < Asc("A")) Or (charCode > Asc("Z")) Then MsgBox("The first character must be uppercase.") End If End If See AlsoChr, ChrW Functions |