Character codes: Difference between revisions

no edit summary
(Pari/GP)
No edit summary
Line 494:
===1.8===
In Ruby 1.8 characters are usually represented directly as their integer character code. Ruby has a syntax for "character literal" which evaluates directly to the integer code: <tt>?a</tt> evaluates to the integer 97. Subscripting a string also gives just the integer code for the character.
 
=={{header|REXX}}==
REXX supports handling of characters with built-in functions,
whether it be hexadecimal, binary (bits), or decimal codes.
<lang rexx>
yyy='c' /*assign a lowercase c to YYY.*/
yyy='34'x /*assign hexadecimal 34 to YYY.*/
yyy=x2c(34) /* (same as above) */
yyy='00110100'b /* (same as above) */
yyy=d2c(97) /*assign decimal code 97 to YYY.*/
 
say y /*displays the value of YYY. */
say c2x(yyy) /*displays the value of YYY in hexadecimal.*/
say c2d(yyy) /*displays the value of YYY in decimal. */
</lang>
 
<lang ruby>> ?a