[plt-scheme] string-upper-case

From: David Storrs (david.storrs at gmail.com)
Date: Sun Oct 25 12:06:18 EDT 2009

On Sun, Oct 25, 2009 at 10:13 AM, Dave Gurnell <d.j.gurnell at gmail.com> wrote:
> Eli Barzilay wrote:
>> On Oct 24, Neil Van Dyke wrote:
>>> I have often wondered why R5RS didn't have a procedure that accepts
>>> a string and returns a new string that is like the input one but
>>> with all the likely names of cats in it capitalized.
>> `string-titlecase' will do that.  (Cat name likelihood proof left as an
>> exercise.)
> Point of note - string-titlecase does both the upping and the downing of
> case, which may be a good or a bad thing depending on what you're trying to
> achieve:
>    (string-titlecase  "Welcome to PLT!") ; => "Welcome To Plt!"
> For what it's worth there's a variant in unlib.plt called
> "string-titlecase*" that only does the upping part:
>    (string-titlecase* "Welcome to PLT!") ; => "Welcome To PLT!"
> I've found this useful from time to time.

Thanks, Dave, that's an important point.  In Perl-land I use the
built-in ucfirst and lcfirst often enough that it's nice to know they
already exist here as well.


Posted on the users mailing list.