This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Capitalize Lisp

5 posts · 3556 views

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

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.