Is there any function to automatically make a string uppercase or lowercase or to capitalize the first letter?
I'm also looking to take a string and 'inspect' the first character so with : "example" i would want to get e as a variable.
THanks
Re: Capitalize Lisp
The closest *function* would probably be
string-capitalize.
For just the
behaviour, try format's case conversion:
(format nil "~@(~A~)" "this is a senTENce.")
Re: Capitalize Lisp
samohtvii wrote:I'm also looking to take a string and 'inspect' the first character so with : "example" i would want to get e as a variable.
CL-USER> (char "example" 0)
#\e
Re: Capitalize Lisp
Thanks guys. Both really helpful. One last question. What is the easiest way to check if the letter i extracted is a vowel.
instead of writing a lot of if statements is there a way to check all vowels at one?
Thanks
Re: Capitalize Lisp
I've found
this document and in it is a function:
(defun vowel-p (char) (find char "aeiou" :test #'char-equal))
I don't know if it is sufficient because vowels exist much more than only english vowels.
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of
CLHS (and the dark themed
version). Temporary mirrors of aferomentioned:
CLHS and a
dark version.