char_int/2

Same as the Visual Prolog predicate char_int(CHAR,INTEGER):

Flow patterns: (i,o),(o,i),(i,i)

Converts between characters and their ASCII values

Remarks:

(i,o) Binds IntArg to the ASCII code for CharArg.

(o,i) Binds CharArg to the character having the ASCII code specified by IntArg (notice that it takes into account only the lower byte of an integer value).

(i,i) Succeeds if IntArg is bound to the ASCII code for CharArg; fails if it is not.

Fail: See remarks for (i,i).

Errors: No errors.

Examples:

char_int('a',X)

X=97

1 Solution

char_int(X,97)

X=a

1 Solution

char_int('a',97)

Yes

char_int('a',197)

No