lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi all,

I searched the list archives and could not find this mentioned before...

I find the string patterns in Lua extremely useful, in particular that
some of the character classes are locale-specific.  But when I am
looking for numbers, I need to refer to the radix point (decimal point
in base 10),  which is also locale-specific.

My first thought was that it would be nice if Lua supported a pattern
that matches the "locale-specific radix point".  And why stop there?
Why not another for a locale-specific currency character, too?  This
quickly gets out of hand.

A better alternative would be to check the current locale in my code,
and then construct the patterns that will become arguments to Lua's
string functions, substituting the right radix point (and currency
character, and others as needed).

Has anyone done this already?  Is there a small library that provides
the mapping from locales to locale-specific characters, or (better) to
Lua string patterns that match numbers, dates, currency, and the like?

--Jim