Difference between revisions of "Chr"

From Xojo Documentation

m (Examples)
m
Line 7: Line 7:
 
|text = Returns the character whose Unicode code point is passed. }}
 
|text = Returns the character whose Unicode code point is passed. }}
  
 
+
==Syntax==
=='''Syntax'''==
 
 
''result''='''Chr'''(''value'')
 
''result''='''Chr'''(''value'')
 
{| class="genericTable"
 
{| class="genericTable"
Line 31: Line 30:
 
|}
 
|}
  
=='''Notes'''==
+
==Notes==
 
The '''Chr''' function returns a string in ASCII encoding for values less than 128 and a UTF-8 encoded string for all other values. If you need to control the exact byte value, you should instead call [[ChrB]].
 
The '''Chr''' function returns a string in ASCII encoding for values less than 128 and a UTF-8 encoded string for all other values. If you need to control the exact byte value, you should instead call [[ChrB]].
  
=='''Examples'''==
+
==Examples==
 
These examples use the '''Chr''' function to return the characters whose ASCII values are specified.
 
These examples use the '''Chr''' function to return the characters whose ASCII values are specified.
  
Line 44: Line 43:
 
</rbcode>
 
</rbcode>
  
=='''See Also'''==
+
==See Also==
 
[[Asc]], [[ChrB]], [[Encoding]], [[InStr]], [[Left]], [[Len]], [[Mid]], [[Right]] functions; [[EndOfLine]], [[TextEncoding]] classes; [[Encodings]] module.
 
[[Asc]], [[ChrB]], [[Encoding]], [[InStr]], [[Left]], [[Len]], [[Mid]], [[Right]] functions; [[EndOfLine]], [[TextEncoding]] classes; [[Encodings]] module.
  

Revision as of 16:13, 26 July 2017

Method

Returns the character whose Unicode code point is passed.

Syntax

result=Chr(value)

Part Type Description
result String The character whose Unicode code point was passed.
value Integer The numeric value ("code point") of the character you want, which must be a valid Unicode character.

Notes

The Chr function returns a string in ASCII encoding for values less than 128 and a UTF-8 encoded string for all other values. If you need to control the exact byte value, you should instead call ChrB.

Examples

These examples use the Chr function to return the characters whose ASCII values are specified.

Dim tab, CR As String
tab = Chr(9) // returns a tab
CR = Chr(13) // returns carriage return
CR = Encodings.ASCII.Chr(13) // also returns carriage return

See Also

Asc, ChrB, Encoding, InStr, Left, Len, Mid, Right functions; EndOfLine, TextEncoding classes; Encodings module.

Text.FromUnicodeCodepoint