Strings.AscW Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns an integer value representing the character code corresponding to a character.
AscW(Char) |
Returns an integer value representing the character code corresponding to a character. |
AscW(String) |
Returns an integer value representing the character code corresponding to a character. |
- Source:
- Strings.vb
- Source:
- Strings.vb
- Source:
- Strings.vb
Returns an integer value representing the character code corresponding to a character.
public:
static int AscW(char String);
public static int AscW (char String);
static member AscW : char -> int
Public Function AscW (String As Char) As Integer
Parameters
- String
- Char
Required. Any valid Char
or String
expression. If String
is a String
expression, only the first character of the string is used for input. If String
is Nothing
or contains no characters, an ArgumentException error occurs.
Returns
The character code corresponding to a character.
Examples
The following example uses the Asc
function to return Integer
character codes corresponding to the first letter in each string.
Dim codeInt As Integer
' The following line of code sets codeInt to 65.
codeInt = Asc("A")
' The following line of code sets codeInt to 97.
codeInt = Asc("a")
' The following line of code sets codeInt to 65.
codeInt = Asc("Apple")
Remarks
Asc
returns the code point, or character code, for the input character. This can be 0 through 255 for single-byte character set (SBCS) values and -32768 through 32767 for double-byte character set (DBCS) values.
AscW
returns the Unicode code point for the input character. This can be 0 through 65535. The returned value is independent of the culture and code page settings for the current thread.
Notitie
The AscB
function of earlier versions of Visual Basic returns a code for a byte, rather than a character. It is used primarily for converting strings in double-byte character set (DBCS) applications. All Visual Basic 2005 strings are in Unicode, and AscB
is no longer supported.
See also
- Chr(Int32)
- ChrW(Int32)
- System.Globalization
- CultureInfo
- ANSICodePage
- ArgumentException
- Functions (Visual Basic)
Applies to
.NET 9 en andere versies
Product | Versies |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
UWP | 10.0 |
- Source:
- Strings.vb
- Source:
- Strings.vb
- Source:
- Strings.vb
Returns an integer value representing the character code corresponding to a character.
public:
static int AscW(System::String ^ String);
public static int AscW (string String);
static member AscW : string -> int
Public Function AscW (String As String) As Integer
Parameters
- String
- String
Required. Any valid Char
or String
expression. If String
is a String
expression, only the first character of the string is used for input. If String
is Nothing
or contains no characters, an ArgumentException error occurs.
Returns
The character code corresponding to a character.
Examples
The following example uses the Asc
function to return Integer
character codes corresponding to the first letter in each string.
Dim codeInt As Integer
' The following line of code sets codeInt to 65.
codeInt = Asc("A")
' The following line of code sets codeInt to 97.
codeInt = Asc("a")
' The following line of code sets codeInt to 65.
codeInt = Asc("Apple")
Remarks
Asc
returns the code point, or character code, for the input character. This can be 0 through 255 for single-byte character set (SBCS) values and -32768 through 32767 for double-byte character set (DBCS) values.
AscW
returns the Unicode code point for the input character. This can be 0 through 65535. The returned value is independent of the culture and code page settings for the current thread.
Notitie
The AscB
function of earlier versions of Visual Basic returns a code for a byte, rather than a character. It is used primarily for converting strings in double-byte character set (DBCS) applications. All Visual Basic 2005 strings are in Unicode, and AscB
is no longer supported.
See also
- Chr(Int32)
- ChrW(Int32)
- System.Globalization
- CultureInfo
- ANSICodePage
- ArgumentException
- Functions (Visual Basic)
Applies to
.NET 9 en andere versies
Product | Versies |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
UWP | 10.0 |
Feedback over .NET
.NET is een opensourceproject. Selecteer een koppeling om feedback te geven: