[etoys-dev] How can I show a number with thousands seperators

Steve Thomas sthomas1 at gosargon.com
Mon Jul 9 10:03:29 EDT 2012


On Mon, Jul 9, 2012 at 5:32 AM, Bert Freudenberg <bert at freudenbergs.de>wrote:

> On 2012-07-08, at 22:01, Steve Thomas wrote:
>
> > Well second coolest "when it works" :)
> >
> > So I was able to change 1000 to '1,000'  but when I used the numeric
> value of '1,000' I get 1 instead of 1000 (note already put an enhancement
> request in tracker).
> >
> > So how can I remove translate '1,000' to 1000? Tried method finder, but
> no luck using "'1,000'. 1000".
>
> Well, the method finder works only if a single method does what you need,
> and there is no such method. One example that is helpful would be
>
>         '1,000' . ',' . '1000'
>
> or the less obvious
>
>         '1,000' . $, . '1000'
>
> (which uses Smalltalk's notation for characters)
>

Cool thanks.

>
> > I can think of a couple ways of doing this (ex:  iterate through the
> characters and remove commas)   But there really should be an easier more
> Etoys friendly way.
> >
> > Also for internationalization I noticed that the decimal mark is always
> a period (even when using German, perhaps they have finally realized we
> have a better system, dividing by 10 is too easy and requires no hard fun ;)
>
> I don't get the joke why you think any of the notations is inherently
> "better".
>
> But maybe we can agree that mixing commas and dots is not ideal. Switching
> the notation based on locale is no solution either. Projects that use
> numerical strings would become dependent on the locale.
>
Agreed.


> The best way I can think of is following the ISO recommendation of using
> spaces for digit grouping. This could be a relatively simple change, and
> would be unambiguous internationally.
>

I like it, need to think about it some more though.  For existing projects
displaying using spaces for digit grouping  could throw off layout on some
existing projects.

Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/etoys-dev/attachments/20120709/3c2fdf44/attachment.html>


More information about the etoys-dev mailing list