TextEncoding.Chr

From Xojo Documentation

Revision as of 15:15, 5 March 2020 by PLefebvre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Method

TextEncoding.Chr(CodePoint as Integer) As String

Supported for all project types and targets.

Returns the character in the given encoding specified by the Unicode CodePoint.

Notes

The "code point" of the character is the same as the value that Asc returns. In general, it is safest to use this rather than the Chr function unless you are dealing with ASCII codes only (0-127).

macOS Info

You can activate the Character viewer window by selecting Emoji & Symbols" from the Edit menu of most apps. This allows you to search for characters and get code point information. For example, search for "neptune" to find a neptune character and then right-click to copy the Character Info show here:

 ♆
 NEPTUNE
 Unicode: U+2646, UTF-8: E2 99 86

You can use the above number as the hexadecimal code point like this:

Var s As String // UTF8 encoding is used by default
s = Encodings.UTF8.Chr(&h2646) // Converts the Unicode character NEPTUNE into its UTF8 counterpart

See Also

For more information about Unicode and the code points, see this article on Wikipedia.