Strings.Asc Yöntem
Tanım
Bir karaktere karşılık gelen karakter kodunu temsil eden bir tamsayı değeri döndürür.Returns an integer value representing the character code corresponding to a character.
Aşırı Yüklemeler
| Asc(Char) |
Bir karaktere karşılık gelen karakter kodunu temsil eden bir tamsayı değeri döndürür.Returns an integer value representing the character code corresponding to a character. |
| Asc(String) |
Bir karaktere karşılık gelen karakter kodunu temsil eden bir tamsayı değeri döndürür.Returns an integer value representing the character code corresponding to a character. |
Asc(Char)
Bir karaktere karşılık gelen karakter kodunu temsil eden bir tamsayı değeri döndürür.Returns an integer value representing the character code corresponding to a character.
public:
static int Asc(char String);
public static int Asc (char String);
static member Asc : char -> int
Public Function Asc (String As Char) As Integer
Parametreler
- String
- Char
Gereklidir.Required. Herhangi bir geçerli Char or String ifadesi.Any valid Char or String expression. StringBir String ifadesiyse, giriş için yalnızca dizenin ilk karakteri kullanılır.If String is a String expression, only the first character of the string is used for input. Varsa String Nothing veya karakter içermiyorsa bir ArgumentException hata oluşur.If String is Nothing or contains no characters, an ArgumentException error occurs.
Döndürülenler
Bir karaktere karşılık gelen karakter kodu.The character code corresponding to a character.
Örnekler
Aşağıdaki örnek, her bir Asc Integer dizedeki ilk harfe karşılık gelen karakter kodlarını döndürmek için işlevini kullanır.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")
Açıklamalar
Asc giriş karakteri için kod noktasını veya karakter kodunu döndürür.Asc returns the code point, or character code, for the input character. Bu, tek baytlı karakter kümesi (SBCS) değerleri için 0 ila 255, çift baytlı karakter kümesi (DBCS) değerleri için de -32.768 ila 32.767 olabilir.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 giriş karakteri için Unicode kod noktasını döndürür.AscW returns the Unicode code point for the input character. Bu, 0 ila 65.535 olabilir.This can be 0 through 65535. Döndürülen değer, geçerli iş parçacığına ilişkin kültür ve kod sayfası ayarlarından bağımsız.The returned value is independent of the culture and code page settings for the current thread.
Not
AscBVisual Basic önceki sürümlerinin işlevi, bir karakter yerine bir bayt için kod döndürür.The AscB function of earlier versions of Visual Basic returns a code for a byte, rather than a character. 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. Tüm Visual Basic 2005 dizeleri Unicode ve AscB artık desteklenmiyor.All Visual Basic 2005 strings are in Unicode, and AscB is no longer supported.
Ayrıca bkz.
- Chr(Int32)
- ChrW(Int32)
- System.Globalization
- CultureInfo
- ANSICodePage
- ArgumentException
- İşlevler (Visual Basic)Functions (Visual Basic)
Şunlara uygulanır
Asc(String)
Bir karaktere karşılık gelen karakter kodunu temsil eden bir tamsayı değeri döndürür.Returns an integer value representing the character code corresponding to a character.
public:
static int Asc(System::String ^ String);
public static int Asc (string String);
static member Asc : string -> int
Public Function Asc (String As String) As Integer
Parametreler
- String
- String
Gereklidir.Required. Herhangi bir geçerli Char or String ifadesi.Any valid Char or String expression. StringBir String ifadesiyse, giriş için yalnızca dizenin ilk karakteri kullanılır.If String is a String expression, only the first character of the string is used for input. Varsa String Nothing veya karakter içermiyorsa bir ArgumentException hata oluşur.If String is Nothing or contains no characters, an ArgumentException error occurs.
Döndürülenler
Bir karaktere karşılık gelen karakter kodu.The character code corresponding to a character.
Örnekler
Aşağıdaki örnek, her bir Asc Integer dizedeki ilk harfe karşılık gelen karakter kodlarını döndürmek için işlevini kullanır.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")
Açıklamalar
Asc giriş karakteri için kod noktasını veya karakter kodunu döndürür.Asc returns the code point, or character code, for the input character. Bu, tek baytlı karakter kümesi (SBCS) değerleri için 0 ila 255, çift baytlı karakter kümesi (DBCS) değerleri için de -32.768 ila 32.767 olabilir.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 giriş karakteri için Unicode kod noktasını döndürür.AscW returns the Unicode code point for the input character. Bu, 0 ila 65.535 olabilir.This can be 0 through 65535. Döndürülen değer, geçerli iş parçacığına ilişkin kültür ve kod sayfası ayarlarından bağımsız.The returned value is independent of the culture and code page settings for the current thread.
Not
AscBVisual Basic önceki sürümlerinin işlevi, bir karakter yerine bir bayt için kod döndürür.The AscB function of earlier versions of Visual Basic returns a code for a byte, rather than a character. 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. Tüm Visual Basic 2005 dizeleri Unicode ve AscB artık desteklenmiyor.All Visual Basic 2005 strings are in Unicode, and AscB is no longer supported.
Ayrıca bkz.
- Chr(Int32)
- ChrW(Int32)
- System.Globalization
- CultureInfo
- ANSICodePage
- ArgumentException
- İşlevler (Visual Basic)Functions (Visual Basic)