Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

string-trim

string-trim

type: function (subr) 
location: built-in
source file: xlstr.c
Common LISP compatible: similar
supported on: all machines

SYNTAX

(string-trim <trim-stuff> <string> )
        <trim-stuff>    -       a string expression
        <string>        -       a string expression

DESCRIPTION

The STRING-TRIM function takes the <trim-stuff> characters and removes them from both ends of the <string>. The <trim-stuff> characters are an un-ordered set of characters to be removed - so any character that occurs in <trim-stuff> is removed if it appears in <string>. A new string is created and returned as the result of this function.

EXAMPLES

(string-trim "." "....foo....")         ; returns "foo"
(string-trim "<>" "<<<<bar>>>>")        ; returns "bar"
(string-trim "(.)" "..(12.34)..")       ; returns "12.34"

COMMON LISP COMPATIBILITY: Common LISP also supports a list of characters as a valid <trim-stuff> argument. An example of this is: (STRING-TRIM '(#\Tab #\Newline) mystring). XLISP does not support this non-string parameter. Porting from XLISP will be no problem, but modifications will be necessary if porting from Common LISP code which uses a list of characters.


Go to the first, previous, next, last section, table of contents.