Next: Cutting and Pasting Strings, Previous: Comparison of Strings, Up: Strings
These procedures return
#t
if the first word in the string (substring) is capitalized, and any subsequent words are either lower case or capitalized. Otherwise, they return#f
. A word is defined as a non-null contiguous sequence of alphabetic characters, delimited by non-alphabetic characters or the limits of the string (substring). A word is capitalized if its first letter is upper case and all its remaining letters are lower case.(map string-capitalized? '("" "A" "art" "Art" "ART")) => (#f #t #f #t #f)
These procedures return
#t
if all the letters in the string (substring) are of the correct case, otherwise they return#f
. The string (substring) must contain at least one letter or the procedures return#f
.(map string-upper-case? '("" "A" "art" "Art" "ART")) => (#f #t #f #f #t)
string-capitalize
returns a newly allocated copy of string in which the first alphabetic character is uppercase and the remaining alphabetic characters are lowercase. For example,"abcDEF"
becomes"Abcdef"
.string-capitalize!
is the destructive version ofstring-capitalize
: it alters string and returns an unspecified value.substring-capitalize!
destructively capitalizes the specified part of string.
string-downcase
returns a newly allocated copy of string in which all uppercase letters are changed to lowercase.string-downcase!
is the destructive version ofstring-downcase
: it alters string and returns an unspecified value.substring-downcase!
destructively changes the case of the specified part of string.(define str "ABCDEFG") => unspecified (substring-downcase! str 3 5) => unspecified str => "ABCdeFG"
string-upcase
returns a newly allocated copy of string in which all lowercase letters are changed to uppercase.string-upcase!
is the destructive version ofstring-upcase
: it alters string and returns an unspecified value.substring-upcase!
destructively changes the case of the specified part of string.