User Tools


====== Function STRING-TRIM, STRING-LEFT-TRIM, STRING-RIGHT-TRIM ====== ====Syntax==== * string-trim //character-bag// //string// → //trimmed-string// * string-left-trim //character-bag// //string// → //trimmed-string// * string-right-trim //character-bag// //string// → //trimmed-string// ====Arguments and Values==== * //character-bag// - a //[[CL:Glossary:sequence]]// containing //[[CL:Glossary:characters]]//. * //string// - a //[[CL:Glossary:string designator]]//. * //trimmed-string// - a //[[CL:Glossary:string]]//. ====Description==== **string-trim** returns a substring of //string//, with all characters in //character-bag// stripped off the beginning and end. **string-left-trim** is similar but strips characters off only the beginning; **string-right-trim** strips off only the end. If no //[[CL:Glossary:characters]]// need to be trimmed from the //string//, then either //string// itself or a copy of it may be returned, at the discretion of the implementation. All of these //[[CL:Glossary:functions]]// observe the //[[CL:Glossary:fill pointer]]//. ====Examples==== <blockquote> (string-trim "abc" "abcaakaaakabcaaa") <r>"kaaak" </r> (string-trim '(#\Space #\Tab #\Newline) " garbanzo beans ") <r>"garbanzo beans" </r> (string-trim " (*)" " ( *three (silly) words* ) ") <r>"three (silly) words"</r> (string-left-trim "abc" "labcabcabc") <r>"labcabcabc" </r> (string-left-trim " (*)" " ( *three (silly) words* ) ") <r>"three (silly) words* ) "</r> (string-right-trim " (*)" " ( *three (silly) words* ) ") <r>" ( *three (silly) words" </r> </blockquote> ====Side Effects==== None. ====Affected By==== The //[[CL:Glossary:implementation]]//. ====Exceptional Situations==== None. ====See Also==== None. ====Notes==== None. \issue{STRING-COERCION:MAKE-CONSISTENT}