User Tools

A PCRE internal error occured. This might be caused by a faulty plugin

======Function STRING-UPCASE, STRING-DOWNCASE, STRING-CAPITALIZE, NSTRING-UPCASE, NSTRING-DOWNCASE, NSTRING-CAPITALIZE ====== ====Syntax==== * **string-upcase** //string// ''&key'' //start// //end// → //cased-string// * **string-downcase** //string// ''&key'' //start// //end// → //cased-string// * **string-capitalize** //string// ''&key'' //start// //end// → //cased-string// * **nstring-upcase** //string// ''&key'' //start// //end// → //string// * **nstring-downcase** //string// ''&key'' //start// //end// → //string// * **nstring-capitalize** //string// ''&key'' //start// //end// → //string// ====Arguments and Values==== * //string// - a //[[CL:Glossary:string designator]]//. For **nstring-upcase**, **nstring-downcase**, and **nstring-capitalize**, the //string// //[[CL:Glossary:designator]]// must be a //[[CL:Glossary:string]]//. * //start//, //end// - //[[CL:Glossary:bounding index designator|bounding index designators]]// of //string//. The defaults for //start// and //end// are ''0'' and **[[CL:Constant Variables:nil]]**, respectively. * //cased-string// - a //[[CL:Glossary:string]]//. ====Description==== **string-upcase**, **string-downcase**, **string-capitalize**, **nstring-upcase**, **nstring-downcase**, **nstring-capitalize** change the case of the subsequence of //string// //[[CL:Glossary:bounded]]// by //start// and //end// as follows: ===string-upcase=== **string-upcase** returns a //[[CL:Glossary:string]]// just like //string// with all lowercase characters replaced by the corresponding uppercase characters. More precisely, each character of the result //[[CL:Glossary:string]]// is produced by applying the function **[[CL:Functions:char-upcase]]** to the corresponding character of //string//. ===string-downcase=== **string-downcase** is like **string-upcase** except that all uppercase characters are replaced by the corresponding lowercase characters (using **[[CL:Functions:char-downcase]]**). ===string-capitalize=== **string-capitalize** produces a copy of //string// such that, for every word in the copy, the first //[[CL:Glossary:character]]// of the "word," if it has //[[CL:Glossary:case]]//, is //[[CL:Glossary:uppercase]]// and any other //[[CL:Glossary:characters]]// with //[[CL:Glossary:case]]// in the word are //[[CL:Glossary:lowercase]]//. For the purposes of **string-capitalize**, a "word" is defined to be a consecutive subsequence consisting of //[[CL:Glossary:alphanumeric]]// //[[CL:Glossary:characters]]//, delimited at each end either by a non-//[[CL:Glossary:alphanumeric]]// //[[CL:Glossary:character]]// or by an end of the //[[CL:Glossary:string]]//. ===nstring-upcase, nstring-downcase, nstring-capitalize=== **nstring-upcase**, **nstring-downcase**, and **nstring-capitalize** are identical to **string-upcase**, **string-downcase**, and **string-capitalize** respectively except that they modify //string//. ---- For **string-upcase**, **string-downcase**, and **string-capitalize**, //string// is not modified. However, if no characters in //string// require conversion, the result may be either //string// or a copy of it, at the implementation's discretion. ====Examples==== <blockquote> (string-upcase "abcde") <r>"ABCDE" </r> (string-upcase "Dr. Livingston, I presume?") <r>"DR. LIVINGSTON, I PRESUME?" </r> (string-upcase "Dr. Livingston, I presume?" :start 6 :end 10) <r>"Dr. LiVINGston, I presume?" </r> (string-downcase "Dr. Livingston, I presume?") <r>"dr. livingston, i presume?"</r> (string-upcase "Doctor Pavel, I'm CIA.") <r>"DOCTOR PAVEL, I'M CIA."</r> (string-downcase "Doctor Pavel, I'm CIA.") <r>"doctor pavel, i'm cia."</r> (string-capitalize "Doctor Pavel, I'm CIA.") <r>"Doctor Pavel, I'M Cia."</r> (string-capitalize "elm 13c arthur;fig don't") <r>"Elm 13c Arthur;Fig Don'T" </r> (string-capitalize " hello ") <r>" Hello " </r> (string-capitalize "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION") <r>"Occluded Casements Forestall Inadvertent Defenestration" </r> (string-capitalize 'kludgy-hash-search) <r>"Kludgy-Hash-Search" </r> (string-capitalize "DON'T!") <r>"Don'T!" ; not "Don't!" </r> (string-capitalize "pipe 13a, foo16c") <r>"Pipe 13a, Foo16c"</r> ([[CL:Macros:defparameter]] *str* ([[CL:Functions:copy-seq]] "0123ABCD890a")) <r>"0123ABCD890a" </r> (nstring-downcase *str* :start 5 :end 7) <r>"0123AbcD890a" </r> *str* <r>"0123AbcD890a" </r> </blockquote> ====Side Effects==== **nstring-upcase**, **nstring-downcase**, and **nstring-capitalize** modify //string// as appropriate rather than constructing a new //[[CL:Glossary:string]]//. ====Affected By==== None. ====Exceptional Situations==== None. ====See Also==== * **[[CL:Functions:char-upcase|Function CHAR-UPCASE]]** * **[[CL:Functions:char-downcase|Function CHAR-DOWNCASE]]** ====Notes==== The result is always of the same length as //string//. \issue{STRING-COERCION:MAKE-CONSISTENT} \issue{SUBSEQ-OUT-OF-BOUNDS} \issue{RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL}