[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Updated code -- Change Case to Title Case
- From: Paul Merrell <marbux@...>
- Date: Fri, 14 Apr 2017 17:52:30 -0700
On Thu, Apr 13, 2017 at 10:40 PM, Paul Merrell <firstname.lastname@example.org> wrote:
> Hi, All,
> I have updated Duncan Cross's code for converting an English string to
> title case, adapted it for use in NoteCase Pro, and posted it online.
> Although the script now makes some calls to the NoteCase Pro API, the
> names of those calls are sufficiently Hungarian that you will likely
> have no problems adapting it to your particular need.
> The adapted script:
> * Fixes a bug in Duncan's original code that was a showstopper in Lua
> 5.2 and 5.3;
> * Works around another bug in that code by converting the string to
> all lower case before converting to Title Case (didn't work on string
> of all upper case characters).
> * Expands the list of words that should not be capitalized.
> The script has a dependency, the pure Lua utf8 library by Xavier Wang,
> namespaced as "utf8ex").  If you're not dealing with utf8 input you
> can probably switch calls to that library, ("utf8ex.") with calls to
> the equivalent Lua string library ("string.").
> The code has been in heavy use for over 6 months without any new
> issues emerging.
> My modifications to Duncan's code are deeded to the public domain.
> I decided to post and announce this because: [i] I haven't found a way
> to contact Duncan Cross to offer him my revisions; [i] debugging the
> original code took quite a bit of work and other code weaknesses
> remain; [ii] I put quite a bit of research and refinement into the
> expanded list of words that should be lower-cased; and [iii] I want to
> save others the work I put in on it; and [iv] perhaps someone wiser
> than me can fix the above-mentioned bug and/or otherwise improve upon
> what I've done.
> Best regards,
> Paul E. Merrell
>  <https://gist.github.com/Marbux/184ed6c310739460c8c040056d7b08ce>
>  <https://github.com/starwing/luautf8>
The problem with my gists not being public has been fixed. GitHub
support says it's because there SPAM robots get a bit greedy at times.
You can now access the script at
[Notice not included in the above original message: The U.S. National
Security Agency neither confirms nor denies that it intercepted this