Function
Returns the ith character of string. Zero-indexed. Ignores fill pointers. Settable.
> (char "Floob-Boober" 0)
=> #\F
> (char "Floob-Boober" 1)
=> #\l
(char s j) == (aref (the string s) j)
Function
Returns a new string of n initial-elements (the default values of which is implementation-dependent).
> (make-string 4)
=> "^@^@^@^@" ; "^@" == \0
> (make-string 4 :initial-element #\L)
=> "LLLL"
Function
Like char but the string must be a simple string. Settable.
same as (char string i).
TODO:
[simple string]: ascii characters sequence is called simple string
Function
Returns true if object is a simple string.
(simple-string-p x) == (typep x 'simple-string)
> (simple-string-p "hello world")
=> T
> (simple-string-p "你好,世界")
=> T
Function
If arg is a string, returns it; if a symbol, returns its name; if a character, returns a string containing it.
> (string "string")
=> "string"
> (let ((var "string"))
(string var))
=> "string"
> (string #\i)
=> "i"
Function
Function
Returns a string in which the first letter of each word is uppercase, and other characters are lowercase. Each sequence of alphabetic characters is a word. The first argument to string-capitalize may also be a symbol, in which case its name is used.
nstring-capitalize is side-effect with modified string.
> (string-capitalize "hEllo")
=> "Hello"
> (string-capitalize "hello WORLD")
=> "Hello World"
> (string-capitalize "DON'T")
=> "Don'T" ; not "Don't"
> (string-capitalize "pipe 13a foo16c")
=> "Pipe 13a Foo16c"
> (string-capitalize "hello world" :start 5)
=> "hello World"
> (let ((var "hello"))
(string-capitalize var)
(print var)
(nstring-capitalize var)
(print var))
=> "hello"
"Hello"
Function
Function
Like string-upcase and nstring-upcase, but characters are converted to
lowercase.
> (string-downcase "HELLO")
=> "hello";
Function
Like string= but ignores case.
(string-equal "hello" "HELLO")
=> T
Function
Like string > but ignores case.
> (string-greaterp "hellp" "HELLO")
=> 4
> (string> "hellp" "HELLO")
=> 0
Function
Function
Returns a string in which lowercase characters are replaced by the corresponding uppercase ones. The start and end are used as in sequence functions. The first argument to string-upcase may also be a symbol, in which case its name is used.
> (string-upcase 'hello)
=> "HELLO"
Function
Like string-trim, but only trims from the front.
> (string-trim-left " ( *three (silly) word* )")
=> "three (silly) word* )"
Function
Like string< but ignores case.
> (string-lessp "HELLO" "hello")
=> NIL
> (string< "HELLO" "hello")
=> 0
Function
Like string/= but ignores case.
> (string-not-equal "HELLO" "hello")
=> NIL
Function
Like string<= but ignores case.
> (string-not-greaterp "HELLO" "hello")
=> 5
> (string<= "HELLO" "hello")
=> 0
Function
Like string>= but ignores case.
> (string-not-lessp "hello" "HELLO")
=> 5
> (string>= "hello" "HELLO")
=> 0
Function
Returns true if object is a string.
> (stringp "string")
=> T
> (stringp 'string)
=> NIL
> (stringp 13)
=> NIL
Function
Like string-trim, but only trims from the back.
(string-right-trim " (*)" " ( *three (silly) words* ) ")
=> " ( *three (silly) words"
Function
Returns a string like string, but with any characters that appear in seq removed from either end.
(string-trim '(#\Space #\Tab #\Newline) " garbanzo beans")
=> "garbanzo beans"
(string-trim " (*)" " ( *three (silly) words* ) ")
=> "three (silly) words"
Function
Returns true if the subsequences of string1 and string2 are the same length and contain the same characters. The parameters start1 and end1, and start2 and end2, work like the usual start and end parameters for string1 and string2 respectively.
> (string= "hello" "hello")
=> T
> (string= "hello" "HELLO")
=> NIL
Function
Returns true if string= would return false.
> (string/= "hello" "HELLO")
=> 0
> (string/= "hello" "hello")
=> NIL
Function
Returns true if the two subsequences contain the same characters up to the end of the first, and the second is longer; or if the subsequences contain diferent characters, and where they difer for the first time, the character in the first substring is char< the one in the second. The parameters are the same as in string=
.
> (string< "hello" "jello")
=> 0
> (string< "hello" "aello")
=> NIL
> (string< "hello" "hello")
=> NIL
Function
Returns true if the two subsequences contain the same characters up to the end of the second, and the first is longer; or if the subsequences contain diferent characters, and where they difer for the first time, the character in the first substring is char> the one in the second. The parameters are the same as in string=
.
> (string> "hello" "jello")
=> NIL
> (string> "hello" "aello")
=> 0
> (string> "hello" "hello")
=> NIL
Function
True if the arguments are string<
or string=
.
> (string<= "hello" "jello")
=> 0
> (string<= "hello" "aello")
=> NIL
> (string<= "hello" "hello")
=> 5
Function
True if the arguments are string> or string=.
> (string>= "hello" "jello")
=> NIL
> (string>= "hello" "aello")
=> 0
> (string>= "hello" "hello")
=> 5