IF Computer > MINERVA > Manual > Reference > Predicates > Atomic term processing > char_code/2

char_code/2

MINERVA
ifcomputer logo
f
Expert Services on the Web

gets the code of a character or reversely.

char_code(+Char, -CharCode)
char_code(-Char, +CharCode)

If Char is an atom with length 1 then CharCode gets unified with the code of Char.
If Char is a variable then Char gets unified with the character belonging to CharCode.

Arguments

Char                   character (atom with length=1)
CharCode               integer (character code of unicode charater
                                between 0'\u0000 and 0'\uffff)

Examples

char_code('a', X). Succeeds with substitution X <- 97
char_code(Y, 98). Succeeds with substitution Y <- 98
char_code('c', 99). Succeeds.

Standard

This predicate is part of the ISO-Prolog Standard.

See also

atom_chars/2, atom_codes/2, atom_concat/3, atom_length/2, atom_number/2, number_chars/2, number_codes/2, parse_atom/2/3, sub_atom/5.

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/atomic_term/char_code/print_en.html
published 2008/11/17 update 1998/8/11 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS