Strings are sequences of characters. The length of a string is the number of characters that it contains. This number is fixed when the string is created. The valid indices of a string are the integers less than the length of the string. The first character of a string has index 0, the second has index 1, and so on.
Kawa note: Kawa’s implementation of strings that contain surrogate characters does not quite follow the R6RS specification. Specifically indexing into such a string retrieves a surrogate rather than a Unicode scalar value. It is not clear what the best solution is - there is a tradeoff between performance, compatibility with R6RS, and interoperability with Java APIs.
Return
#tifobjis a string,#fotherwise.
Return a newly allocated string of length
k. Ifcharis given, then all elements of the string are initialized tochar, otherwise the contents of thestringare unspecified.
Return a newly allocated string composed of the arguments.
Procedure: string-length string
Return the number of characters in the given
stringas an exact integer object.
Procedure: string-ref stringk
kmust be a valid index ofstring. Thestring-refprocedure returns characterkofstringusing zero–origin indexing.time.
Procedure: string=? string1string2string3…
Return
#tif the strings are the same length and contain the same characters in the same positions. Otherwise, thestring=?procedure returns#f.(string=? "Straße" "Strasse") ⇒ #f
Procedure: string<? string1string2string3…
Procedure: string>? string1string2string3…
Procedure: string<=? string1string2string3…
Procedure: string>=? string1string2string3…
These procedures are the lexicographic extensions to strings of the corresponding orderings on characters. For example,
string<?is the lexicographic ordering on strings induced by the orderingchar<?on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string.(string<? "z" "ß") ⇒ #t (string<? "z" "zz") ⇒ #t (string<? "z" "Z") ⇒ #f
Procedure: substring stringstartend
stringmust be a string, andstartandendmust be exact integer objects satisfying:0 <=start<=end<= (string-lengthstring)The
substringprocedure returns a newly allocated string formed from the characters ofstringbeginning with indexstart(inclusive) and ending with indexend(exclusive).
Procedure: string-append string…
Return a newly allocated string whose characters form the concatenation of the given strings.
Procedure: string->list string
listmust be a list of characters.The
string->listprocedure returns a newly allocated list of the characters that make up the given string.The
list->stringprocedure returns a newly allocated string formed from the characters inlist.The
string->listandlist->stringprocedures are inverses so far asequal?is concerned.
Returns a newly allocated copy of the given
string.