Strings
upper
StdLib
upper converts any lower case characters to upper case.
upper "this is lower case"
"THIS IS LOWER CASE"
lower
StdLib
lower converts any upper case characters to lower case.
lower "THIS IS UPPER CASE"
"this is upper case"
replace
Builtin
replace replaces all instances of a given string that occur within a string with another string.
replace "Sean Connery is the worst Bond." "worst" "best"
"Sean Connery is the best Bond."
find
Builtin
find returns an index for a particular string if it exists within a given string and False (0) if it does not.
(find "Operation Market Garden" "Market")
(find "I've got lunatics laughing at me from the woods." "Jeeps")
10
0
caseless_find
StdLib
caseless_find works just like find, but it ignores case.
caseless_find "ABCD" "bcd"
1
split
Builtin
split takes a string and splits it at a particular index returning two strings in a list.
split "Late 14th century, Ming Dynasty. How it breaks the heart." 14
{"Late 14th century, Ming Dynasty. How it " "breaks the heart."}
chop
Builtin
chop is similar to split, but it only returns the first part of the string and discards the rest.
chop "Got lost in his own museum huh?" 8
"Got lost"
rand_string
StdLib
rand_string returns a random string for a given length
(rand_string 10)
(rand_string 10)
(rand_string 15)
"7IPdDBk&vT"
"6V6^Nk#+yC"
"^-B*AYghRNzQ+g9"
delimit
StdLib
delimit takes a string, splits it at a particular character and returns a list.
delimit "," "a,b,c,d,e,f,g"
{"a" "b" "c" "d" "e" "f" "g"}
relimit
StdLib
relimit takes a list of strings and places a delimiter between them, returning a single string.
relimit "," (list "a" "b" "c")
"a,b,c"
string_to_index_list
StdLib
string_to_index_list takes a string as input and returns a list of numbers that correspond to each character.
string_to_index_list "Bond, James Bond"
{27 14 13 3 77 76 35 0 12 4 18 76 27 14 13 3}
index_list_to_string
StdLib
index_list_to_string does the opposite of string_to_index_list and converts a list of numbers back into a string.
index_list_to_string (list 27 14 13 3 77 76 35 0 12 4 18 76 27 14 13 3)
"Bond, James Bond"
string_rep
StdLib
string_rep takes a string as input and returns a list with two numbers that can be used later to see if it matches another string. Useful when you want to minimize memory use or do many comparisons of long strings rapidly. Note: This method is prone to false positives.
string_rep "Sean Connery"
{12 250}
string_rep_compare
StdLib
string_rep_compare takes two string reps and compares them. Returns True (1) if they might match and False (0) if they don’t match.
string_rep_compare (string_rep "Bond, James Bond.") (string_rep "Bond, James Bond.")
1
string_rep_compare_string
StdLib
string_hash_compare compares a string rep to a given string to see if they match. Returns True (1) if they might match and False (0) if they don’t match.
(string_rep_compare_string (string_rep "Sean Connery") "Sean Connery")
(string_rep_compare_string (string_rep "Sean Connery") "Pierce Brosnan")
1
0