Strings.AscW Método
Definición
Devuelve un valor entero que representa el código de carácter correspondiente a un carácter.Returns an integer value representing the character code corresponding to a character.
Sobrecargas
| AscW(Char) |
Devuelve un valor entero que representa el código de carácter correspondiente a un carácter.Returns an integer value representing the character code corresponding to a character. |
| AscW(String) |
Devuelve un valor entero que representa el código de carácter correspondiente a un carácter.Returns an integer value representing the character code corresponding to a character. |
AscW(Char)
Devuelve un valor entero que representa el código de carácter correspondiente a un carácter.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
Parámetros
- String
- Char
Obligatorio.Required. Cualquier expresión válida de tipo Char o String.Any valid Char or String expression. Si String es una expresión de tipo String, sólo se utiliza el primer carácter de la cadena para la entrada.If String is a String expression, only the first character of the string is used for input. Si String es Nothing o no contiene caracteres, se genera un error ArgumentException.If String is Nothing or contains no characters, an ArgumentException error occurs.
Devoluciones
Código de carácter correspondiente a un carácter.The character code corresponding to a character.
Ejemplos
En el ejemplo siguiente se usa la Asc función para devolver Integer códigos de carácter correspondientes a la primera letra de cada cadena.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")
Comentarios
Asc Devuelve el punto de código o el código de carácter para el carácter de entrada.Asc returns the code point, or character code, for the input character. Puede ser de 0 a 255 para los valores del juego de caracteres de un solo byte (SBCS) y de-32768 a 32767 para los valores del juego de caracteres de doble byte (DBCS).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 Devuelve el punto de código Unicode para el carácter de entrada.AscW returns the Unicode code point for the input character. Puede ser de 0 a 65535.This can be 0 through 65535. El valor devuelto es independiente de la configuración de la página de códigos y la referencia cultural del subproceso actual.The returned value is independent of the culture and code page settings for the current thread.
Nota
La AscB función de versiones anteriores de Visual Basic devuelve un código para un byte, en lugar de un carácter.The AscB function of earlier versions of Visual Basic returns a code for a byte, rather than a character. Se usa principalmente para convertir cadenas en aplicaciones de juegos de caracteres de doble byte (DBCS).It is used primarily for converting strings in double-byte character set (DBCS) applications. Todas las cadenas Visual Basic 2005 están en Unicode y ya AscB no se admiten.All Visual Basic 2005 strings are in Unicode, and AscB is no longer supported.
Consulte también
- Chr(Int32)
- ChrW(Int32)
- System.Globalization
- CultureInfo
- ANSICodePage
- ArgumentException
- Funciones (Visual Basic)Functions (Visual Basic)
Se aplica a
AscW(String)
Devuelve un valor entero que representa el código de carácter correspondiente a un carácter.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
Parámetros
- String
- String
Obligatorio.Required. Cualquier expresión válida de tipo Char o String.Any valid Char or String expression. Si String es una expresión de tipo String, sólo se utiliza el primer carácter de la cadena para la entrada.If String is a String expression, only the first character of the string is used for input. Si String es Nothing o no contiene caracteres, se genera un error ArgumentException.If String is Nothing or contains no characters, an ArgumentException error occurs.
Devoluciones
Código de carácter correspondiente a un carácter.The character code corresponding to a character.
Ejemplos
En el ejemplo siguiente se usa la Asc función para devolver Integer códigos de carácter correspondientes a la primera letra de cada cadena.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")
Comentarios
Asc Devuelve el punto de código o el código de carácter para el carácter de entrada.Asc returns the code point, or character code, for the input character. Puede ser de 0 a 255 para los valores del juego de caracteres de un solo byte (SBCS) y de-32768 a 32767 para los valores del juego de caracteres de doble byte (DBCS).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 Devuelve el punto de código Unicode para el carácter de entrada.AscW returns the Unicode code point for the input character. Puede ser de 0 a 65535.This can be 0 through 65535. El valor devuelto es independiente de la configuración de la página de códigos y la referencia cultural del subproceso actual.The returned value is independent of the culture and code page settings for the current thread.
Nota
La AscB función de versiones anteriores de Visual Basic devuelve un código para un byte, en lugar de un carácter.The AscB function of earlier versions of Visual Basic returns a code for a byte, rather than a character. Se usa principalmente para convertir cadenas en aplicaciones de juegos de caracteres de doble byte (DBCS).It is used primarily for converting strings in double-byte character set (DBCS) applications. Todas las cadenas Visual Basic 2005 están en Unicode y ya AscB no se admiten.All Visual Basic 2005 strings are in Unicode, and AscB is no longer supported.
Consulte también
- Chr(Int32)
- ChrW(Int32)
- System.Globalization
- CultureInfo
- ANSICodePage
- ArgumentException
- Funciones (Visual Basic)Functions (Visual Basic)