Characters and Strings

circle-info

TODO: rectify ord and chr with REPL formatting; should results format as in the REPL?

Character Functions

ord

Converts a digit character to its numeric value. For non-digit characters, it returns the ASCII value minus 48.

ord {1}    == 1
ord {A}    == 17
ord {a}    == 49

chr

Converts a number to its corresponding ASCII character by adding 48.

chr 48    == {0}
chr 65    == {A}
chr 97    == {a}

isDigit

Checks if a character is a digit (0-9).

isDigit {0}    == 1
isDigit {9}    == 1
isDigit {a}    == 0

isHexDigit

Checks if a character is a hexadecimal digit (0-9, a-f, A-F).

isUpper

Checks if a character is uppercase.

isLower

Checks if a character is lowercase.

isAlpha

Checks if a character is alphabetic (a-z, A-Z).

isPrint

Checks if a character is printable (space through tilde).

isAlphaNum

Checks if a character is alphanumeric (a-z, A-Z, 0-9).

toLower

Converts a character to lowercase.

toUpper

Converts a character to uppercase.

Special Characters

newlineChar

The ASCII code for newline (10).

tabChar

The ASCII code for tab (9).

spaceChar

The ASCII code for space (32).

Number to String Conversion

listDigits

Converts a number to a list of digit characters.

digits

Converts a number to a row of digit characters.

String Functions

strLen

Returns the length of a string.

strWeld

Concatenates two strings.

strCat

Concatenates a row of strings.

strToList

circle-info

TODO: REPL formatting?

Converts a string to a list of character codes.

strFromList

circle-info

TODO: REPL formatting?

Converts a list of character codes to a string.

explode

circle-info

TODO: REPL formatting?

Converts a string to a row of character codes.

implode

Converts a row of character codes to a string.

strToUpper

Converts a string to uppercase.

strToLower

Converts a string to lowercase.

strCapitalize

Capitalizes the first character of a string.

strIsCapitalized

Checks if the first character of a string is uppercase.

strMap

Applies a function to every character in a string.

String Parsing Functions

isDecimalLit

Checks if a string is a valid decimal literal.

loadDecimal

Parses a decimal literal string into a number.

isHexLit

Checks if a string is a valid hexadecimal literal (starting with "0x").

loadHexLit

Parses a hexadecimal literal string into a number.

loadKeyWord

Parses a string as either a decimal literal, hexadecimal literal, or returns the string itself.

Last updated