4D v13.4Character code |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
Character code
Character code
The Character code command returns the current character code of character.
For more information about the different modes for managing strings in 4D, please refer to the ASCII Codes section. The Char function is the counterpart of Character code. It returns the character that a UTF-16 or ASCII code represents. Important: In ASCII compatibility mode, all the text values, fields, or variables that you have not yet converted to another ASCII map are Mac OS-encoded on both Macintosh and Windows. For more information, see the section ASCII Codes. Uppercase and lowercase characters are considered equal within a comparison. You can use Character code to differentiate between uppercase and lowercase characters. Thus, this line returns True: ("A"="a") On the other hand, this line returns False: (Character code("A")=Character code("a")) This example returns the code of the first character of the string "ABC": GetCode:=Character code("ABC") ` GetCode gets 65, the character code of A The following example tests for carriage returns and tabs: For($vlChar;1;Length(vtText)) When executed multiple times on large texts, this test will run faster when compiled if it is written this way: For($vlChar;1;Length(vtText)) The second piece of code runs faster for two reasons: it does only one character reference by iteration and uses LongInt comparisons instead of string comparisons to test for carriage returns and tabs. Use this technique when working with common codes such as CR and TAB. |
PROPERTIES
Product: 4D
INDEX HISTORY
Modified: 4D v11 SQL SEE ALSO
ASCII Codes |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||