Strings.AscW Method (String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns an Integer value representing the character code corresponding to a character.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Syntax

'Declaration
Public Shared Function AscW ( _
    String As String _
) As Integer
public static int AscW(
    string String
)

Parameters

  • String
    Type: System.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.

Return Value

Type: System.Int32
Returns an Integer value representing the character code corresponding to a character.

Remarks

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.

Examples

The following example uses the AscW 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 = AscW("A")
' The following line of code sets codeInt to 97.
codeInt = AscW("a")
' The following line of code sets codeInt to 65.
codeInt = AscW("Apple")

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.