Strings.ChrW(Int32) Yöntem
Tanım
Belirtilen karakter koduyla ilişkili karakteri döndürür.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
Parametreler
- CharCode
- Int32
Gereklidir.Required. IntegerKarakter için kod noktasınıveya karakter kodunu temsil eden bir ifade.An Integer expression representing the code point, or character code, for the character.
Döndürülenler
Belirtilen karakter koduyla ilişkili karakter.The character associated with the specified character code.
Özel durumlar
CharCode<-32768 veya > 65535 için ChrW .CharCode < -32768 or > 65535 for ChrW.
Örnekler
Aşağıdaki örnek, Chr belirtilen karakter koduyla ilişkili karakteri döndürmek için işlevini kullanır.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)
Açıklamalar
CharCodeVe arasındaki depolama farklarını dengeler için kabul edilen asimetrik Aralık Short Integer .The asymmetric range accepted for CharCode compensates for the storage differences between the Short and the Integer. Örneğin,-29183 bir, Short ancak + 36353 ' dir Integer .For example, -29183 is a Short but +36353 is an Integer. Bu ayrıca 6,0 Visual Basic uyumluluğunu da kolaylaştırır.This also facilitates compatibility with Visual Basic 6.0.
ChrEncoding System.Text geçerli iş parçacığının tek baytlık bir karakter KÜMESI (SBCS) veya çift baytlı karakter KÜMESI (DBCS) kullanıp kullanmadığını anlamak için ad alanındaki sınıfını kullanır.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). Daha sonra CharCode uygun kümesinde bir kod noktası olarak alır.It then takes CharCode as a code point in the appropriate set. Aralık, SBCS karakterleri için 0 ila 255, DBCS karakterleri için 65535 ile 32768 arasında olabilir.The range can be 0 through 255 for SBCS characters and -32768 through 65535 for DBCS characters.
Döndürülen değer, ANSICodePage TextInfo ad alanındaki sınıfının özelliğinde yer alan geçerli iş parçacığının kod sayfasına bağlıdır System.Globalization .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. Öğesini belirterek elde edebilirsiniz ANSICodePage System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage .You can obtain ANSICodePage by specifying System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage.
ChrW``CharCodebir Unicode kod noktası olarak alır.ChrW takes CharCode as a Unicode code point. Aralık, geçerli iş parçacığının kültür ve kod sayfası ayarlarından bağımsızdır.The range is independent of the culture and code page settings for the current thread. -32768 ile-1 arasındaki değerler + 32768 ile + 65535 aralığındaki değerlerle aynı şekilde işlenir.Values from -32768 through -1 are treated the same as values in the range +32768 through +65535.
0 ile 31 arasındaki sayılar standart yazdırılamayan ASCII kodlarıyla aynıdır.Numbers from 0 through 31 are the same as standard nonprintable ASCII codes. Örneğin, Chr(10) bir satır besleme karakteri döndürür.For example, Chr(10) returns a line feed character.
Not
ChrBVisual Basic önceki sürümlerindeki işlev tek bir bayt döndürüyor.The ChrB function in earlier versions of Visual Basic returns a single byte. Esas olarak çift baytlı karakter kümesi (DBCS) uygulamalarında dize dönüştürmek için kullanılır.It is used primarily for converting strings in double-byte character set (DBCS) applications. Visual Basic ve .NET Framework tüm dizeler Unicode 'Dur ve ChrB artık desteklenmiyor.All strings in Visual Basic and the .NET Framework are in Unicode, and ChrB is no longer supported.