This page is incomplete, and needs review
Characters are demarcated with single quotes, i.e. the character c is written 'c'. Some characters may need an escape character (the back-slash) because the sequence 'char for the char being discussed has a special meaning in ATS. One such example is '(, so we actually write '\(' to denote the left parentheses. We note here that strings, in contrast, are demarcated with double quotes.
The following list is believed to be exhaustive:
(How do we specify ASCII codes in Hex, Bin, Dec, Oct, etc?)
Please note that 'char' maps directly to C type 'char', therefore it is the size of 1 byte, and cannot be used to represent any multi-byte encoding, such as UTF-16 or UTF-32.
(Also see our [Rosetta Stone].)
char to string
// prelude/SATS/char.sats
// stringization
//
fun tostrptr_char
(c: char):<> strptr1 = "atspre_tostrptr_char"
overload tostrptr with tostrptr_char
fun tostring_char
(c: char):<> string (1) = "atspre_tostrptr_char"
overload tostring with tostring_char
Wiki: Home
Wiki: Rosetta Stone
Anonymous