Greg Fenton writes:
> I'm a hack...there, I said it.
>
> Need help with a simple elisp function. I want to
> take a string, strip out all lower-case characters,
> and down-case the resulting string.
>
> So, for example,
> (my-func "NumberFormatException") yields "nfe"
> (my-func "IOException") yields "ioe"
>
> I can write a function to do it using my elementary knowledge
> of low-level elisp functions, but I'm SURE there's an easy
> way to do this (or might even already be such a function in
> JDE???)
>
Here's one way to do it.
(defun jde-create-instance-name (class-name)
"Generates a name for an instance
of a class from the name of the class."
(mapconcat
(lambda (chr)
(let ((c (char-to-string chr))
case-fold-search)
(if (string-match "[A-Z]" c)
(downcase c))))
class-name
""))
- Paul