Strings.ChrW(Int32) Método

Definición

Devuelve el carácter asociado al código de carácter especificado.Returns the character associated with the specified character code.

public:
 static char ChrW(int CharCode);
public static char ChrW (int CharCode);
static member ChrW : int -> char
Public Function ChrW (CharCode As Integer) As Char

Parámetros

CharCode
Int32

Obligatorio.Required. Expresión de tipo Integer que representa el punto de código o el código del carácter.An Integer expression representing the code point, or character code, for the character.

Devoluciones

Char

Carácter asociado al código de carácter especificado.The character associated with the specified character code.

Excepciones

CharCode < -32768 o > 65535 para ChrW.CharCode < -32768 or > 65535 for ChrW.

Ejemplos

En el ejemplo siguiente se utiliza la Chr función para devolver el carácter asociado al código de carácter especificado.The following example uses the Chr function to return the character associated with the specified character code.

Dim associatedChar As Char
' Returns "A".
associatedChar = Chr(65)
' Returns "a".
associatedChar = Chr(97)
' Returns ">".
associatedChar = Chr(62)
' Returns "%".
associatedChar = Chr(37)

Comentarios

El intervalo asimétrico aceptado para CharCode compensa las diferencias de almacenamiento entre Short y Integer .The asymmetric range accepted for CharCode compensates for the storage differences between the Short and the Integer. Por ejemplo,-29183 es un, Short pero + 36353 es un Integer .For example, -29183 is a Short but +36353 is an Integer. Esto también facilita la compatibilidad con Visual Basic 6,0.This also facilitates compatibility with Visual Basic 6.0.

Chr usa la Encoding clase en el System.Text espacio de nombres para determinar si el subproceso actual está utilizando un juego de caracteres de un solo byte (SBCS) o un juego de caracteres de doble byte (DBCS).Chr uses the Encoding class in the System.Text namespace to determine if the current thread is using a single-byte character set (SBCS) or a double-byte character set (DBCS). A continuación, toma CharCode como punto de código en el conjunto adecuado.It then takes CharCode as a code point in the appropriate set. El intervalo puede ser de 0 a 255 para los caracteres SBCS y de-32768 a 65535 para los caracteres DBCS.The range can be 0 through 255 for SBCS characters and -32768 through 65535 for DBCS characters.

El valor devuelto depende de la página de códigos del subproceso actual, que se encuentra en la ANSICodePage propiedad de la TextInfo clase en el System.Globalization espacio de nombres.The returned value depends on the code page for the current thread, which is contained in the ANSICodePage property of the TextInfo class in the System.Globalization namespace. Puede obtener ANSICodePage especificando System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage .You can obtain ANSICodePage by specifying System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage.

ChrW toma CharCode como punto de código Unicode.ChrW takes CharCode as a Unicode code point. El intervalo es independiente de la configuración de la página de códigos y la referencia cultural del subproceso actual.The range is independent of the culture and code page settings for the current thread. Los valores de-32768 a-1 se tratan igual que los valores del intervalo de + 32768 a + 65535.Values from -32768 through -1 are treated the same as values in the range +32768 through +65535.

Los números del 0 al 31 son los mismos que los códigos ASCII estándar no imprimibles.Numbers from 0 through 31 are the same as standard nonprintable ASCII codes. Por ejemplo, Chr(10) devuelve un carácter de avance de línea.For example, Chr(10) returns a line feed character.

Nota

La ChrB función de versiones anteriores de Visual Basic devuelve un solo byte.The ChrB function in earlier versions of Visual Basic returns a single byte. 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 de Visual Basic y .NET Framework están en Unicode y ya ChrB no se admiten.All strings in Visual Basic and the .NET Framework are in Unicode, and ChrB is no longer supported.

Se aplica a

Consulte también