Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
Class
Microsoft.VisualBasic.Strings Syntax
Dim result As Integer = Asc(string) Dim result As Integer = AscW(string)
Description
The 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 Glance
The Asc version uses the active code page of the current thread; the AscW function always uses the general Unicode character set. Example
Dim 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 Also
Chr, ChrW Functions |
Категории