StringSupport
Author: Kurt Pagani
Date Created: Sat Jan 25 20:11:03 CET 2020
License: BSD
References:
http://clhs.lisp.se/Body/22_c.htm
https://en.wikipedia.org/wiki/String_operations
Description:
format : (STR,STR) -> STR
format(fmt,str) returns a formatted string according to the
format instructions in 'fmt'.
format : (STR,LSTR) -> STR
format(fmt,[s1,s2,..]) returns a formatted string according to the
format instructions in 'fmt'.
fmtStrIter : STR -> STR
fmtStrIter(sep) provides a format string that can be used
in 'format' to iterate over a list of strings.
join : (STR,LSTR) -> STR
join(sep,[s1,s2,s3,...]) joins the strings s1,s2,... by the
separator string 'sep'.
atomize : STR -> LSTR
atomize(str) segments the string 'str' into a list of character
string (not the same as Character!). Applying 'concat' to the
resulting list will restore the string.
ascii : STR -> List Integer
ascii(str) returns the ASCII code (ord) of each character as
a list of positive integers.
radixEnglish : Integer -> STR
radix(n) gives a sring represenation of an integer as an English
numeral.
radixRoman : Integer -> STR
radix(n) gives a sring represenation of an integer as a Roman
numeral.
radixOldRoman : Integer -> STR
radix(n) gives a sring represenation of an integer as an old Roman
numeral.
format : (STR,INT) -> STR
format(fmt,n) formats an integer number according to fmt:
Radix ~R, Decimal ~D, Binary ~B, Octal ~O, ~Hex ~X. Modifiers:
"@":sign, ":":commas, prefix: mincols, padchar ...: e.g. ~12@:D
yields "+44,452,666,888,888".
newline : STR
newline() -> "~%"
freshline : STR
freshline() -> "~&"
newpage : STR
newpage() -> "~|"
tilde : STR
tilde() -> "~~"
natoAlphabet: CHAR -> STR
https://en.wikipedia.org/wiki/NATO_phonetic_alphabet
Try natoAlphabet (char "a")
morseAlphabet: CHAR -> STR
https://en.wikipedia.org/wiki/Morse_code
Try morseAlphabet (char "k")
spellNATO : STR -> STR
spellNATO(str) spells the string 'str' as ICAO sequence.
spellMorse : STR -> STR
spellMorse(str) spells the string 'str' as Morse sequence.
substOnce : (STR,STR,STR) -> STR
substOnce(a,b,c) substitute once a for b in c.
subst : (STR,STR,STR) -> STR
subst(a,b,c) substitute all a for b in c.
rest : STR -> STR
rest(s) is all but the first character of the string.
last : STR -> STR
last(s) is the last character of the string s.
proj : (List CHAR,STR) -> STR
proj(A,s) is the string that results by removing all characters that
are not in the alphabet A.