Difference between revisions of "Documentation/How Tos/Calc: CODE function"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial content)
 
(character mapping)
Line 6: Line 6:
 
=== Syntax: ===
 
=== Syntax: ===
 
<tt>'''CODE(text)'''</tt>
 
<tt>'''CODE(text)'''</tt>
: returns the numeric code for the first character of the text string <tt>'''text'''</tt>. The code is found from the code table currently loaded.
+
: returns the numeric code for the first character of the text string <tt>'''text'''</tt>, in the range 0-255.
 +
 
 +
: Codes greater than 127 may depend on your system's character mapping (for example iso-8859-1, iso-8859-2, Windows-1252, Windows-1250), and hence may not be portable.
  
 
=== Example: ===
 
=== Example: ===
Line 19: Line 21:
  
 
'''[[Documentation/How_Tos/Calc: Text functions|Text functions]]'''
 
'''[[Documentation/How_Tos/Calc: Text functions|Text functions]]'''
 +
 +
=== Issues: ===
 +
* The international standard ODFF will introduce the more versatile functions <tt>'''UNICODE'''</tt> and <tt>'''UNICHAR'''</tt>, which will be implemented in Calc.

Revision as of 19:24, 18 January 2008


CODE

returns the numeric code for the first character in a text string.

Syntax:

CODE(text)

returns the numeric code for the first character of the text string text, in the range 0-255.
Codes greater than 127 may depend on your system's character mapping (for example iso-8859-1, iso-8859-2, Windows-1252, Windows-1250), and hence may not be portable.

Example:

CODE("H")

returns 72, the character code for "H".

CODE("Hello")

also returns 72.

See also:

CHAR

Text functions

Issues:

  • The international standard ODFF will introduce the more versatile functions UNICODE and UNICHAR, which will be implemented in Calc.
Personal tools