Chr Function

ត្រឡប់​តួអក្សរ​ដែល​ត្រូវ​គ្នា​ទៅ​នឹង​កូដ​តួ​អក្សរ​ជាក់លាក់ ។

Syntax:


      Chr[$](charcode As Integer) As String
    

Return value:

String

Parameters:

charcode: a numeric expression that represents a valid 8-bit ASCII value (0-255) or a 16-bit Unicode value. (To support expressions with a nominally negative argument like Chr(&H8000) in a backwards-compatible way, values in the range −32768 to −1 are internally mapped to the range 32768 to 65535.)

warning

When VBA compatibility mode is enabled (Option VBASupport 1), charcode is a numeric expression that represents a valid 8-bit ASCII value (0-255) only.


ប្រើ​អនុគមន៍ Chr$ ដើម្បី​ផ្ញើ​លំដាប់​វត្ថុ​បញ្ជា​ពិសេស​ទៅ​ម៉ាស៊ីន​បោះពុម្ព ឬ​ទៅ​ប្រភព​បង្ហាញ​​ផ្សេង​ទៀត ។ អ្នក​ក៏​អាច​ប្រើ​វា​ដើម្បី​បញ្ចូល​សញ្ញា​សម្រង់​ក្នុង​កន្សោម​ខ្សែ​អក្សរ​មួយ ។

Error codes:

5 ការ​ហៅ​បែបបទ​មិន​ត្រឹមត្រូវ

6 លើស​ចំណុះ

note

An overflow error will occur when VBA compatibility mode is enabled and the expression value is greater than 255.


Example:


        Sub ExampleChr
            REM This example inserts quotation marks (ASCII value 34) in a string.
            MsgBox "A " + Chr$(34) + "short" + Chr(34) + " trip."
            REM សន្លឹក​បោះពុម្ព​​នឹង​បង្ហាញ​ក្នុង​ប្រអប់​ជា ៖ A "short" trip ។
            MsgBox Chr(charcode := 64) ' "@" sign
        End Sub