How can I show a number with thousands seperators

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I show a number with thousands seperators

Steve Thomas
When I set a text's numeric value, I would like to include the thousands separator to make it easier to compare two numbers.

Thanks,
Stephen

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev
Reply | Threaded
Open this post in threaded view
|

Re: [squeakland] How can I show a number with thousands seperators

Bert Freudenberg
On 07.07.2012, at 16:09, Steve Thomas wrote:

> When I set a text's numeric value, I would like to include the thousands separator to make it easier to compare two numbers.

It's not built into Etoys.

To find the right Squeak method, open a method finder. Give it an example, e.g. "12345. '12,345'". It will look for a method with that receiver giving that result.

(this works for methods with arguments, too. E.g. try "2. 3. 8")

- Bert -

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev
Reply | Threaded
Open this post in threaded view
|

Re: [squeakland] How can I show a number with thousands seperators

Steve Thomas
Okay, Method Finder has to be the second coolest code tool ever.  I simply give an example of what I want to do and it finds it.

FYI to get to Method Finder: CMD-<comma> (CTRL-<comma> on PC, I think) -> open... -> method finder

Thanks Bert.

Stephen

On Sun, Jul 8, 2012 at 9:02 AM, Bert Freudenberg <[hidden email]> wrote:
On 07.07.2012, at 16:09, Steve Thomas wrote:

> When I set a text's numeric value, I would like to include the thousands separator to make it easier to compare two numbers.

It's not built into Etoys.

To find the right Squeak method, open a method finder. Give it an example, e.g. "12345. '12,345'". It will look for a method with that receiver giving that result.

(this works for methods with arguments, too. E.g. try "2. 3. 8")

- Bert -

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland


_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev
Reply | Threaded
Open this post in threaded view
|

Re: [squeakland] How can I show a number with thousands seperators

Steve Thomas
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".
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 ;)

Thanks,
Stephen

On Sun, Jul 8, 2012 at 3:02 PM, Steve Thomas <[hidden email]> wrote:
Okay, Method Finder has to be the second coolest code tool ever.  I simply give an example of what I want to do and it finds it.

FYI to get to Method Finder: CMD-<comma> (CTRL-<comma> on PC, I think) -> open... -> method finder

Thanks Bert.

Stephen


On Sun, Jul 8, 2012 at 9:02 AM, Bert Freudenberg <[hidden email]> wrote:
On 07.07.2012, at 16:09, Steve Thomas wrote:

> When I set a text's numeric value, I would like to include the thousands separator to make it easier to compare two numbers.

It's not built into Etoys.

To find the right Squeak method, open a method finder. Give it an example, e.g. "12345. '12,345'". It will look for a method with that receiver giving that result.

(this works for methods with arguments, too. E.g. try "2. 3. 8")

- Bert -

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland



_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev
Reply | Threaded
Open this post in threaded view
|

Re: How can I show a number with thousands seperators

Bert Freudenberg
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)

> 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.

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.

- Bert -

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev
Reply | Threaded
Open this post in threaded view
|

Re: How can I show a number with thousands seperators

Steve Thomas
On Mon, Jul 9, 2012 at 5:32 AM, Bert Freudenberg <[hidden email]> 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

_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev
Reply | Threaded
Open this post in threaded view
|

Re: How can I show a number with thousands seperators

Steve Thomas
So in talking to a friend of mine from India, they have a numeral system using lakhs (lacs) (1,00,000 equal to 100 000) and crores (1,00,00,000 equal to 10 000 000).  Then of course when you get to big numbers they express things in crores. So you can see 1,00,000 crores (or 1,00,000,00,00,000).

Bottom line.  I don't think the need for this change is that great and too many issues.  I'll dip into smalltalk when needed.

Thanks,
Stephen

On Mon, Jul 9, 2012 at 10:03 AM, Steve Thomas <[hidden email]> wrote:
On Mon, Jul 9, 2012 at 5:32 AM, Bert Freudenberg <[hidden email]> 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


_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev
Reply | Threaded
Open this post in threaded view
|

Re: How can I show a number with thousands seperators

Bert Freudenberg

On 25.07.2012, at 20:57, Steve Thomas wrote:

So in talking to a friend of mine from India, they have a numeral system using lakhs (lacs) (1,00,000 equal to 100 000) and crores (1,00,00,000 equal to 10 000 000).  Then of course when you get to big numbers they express things in crores. So you can see 1,00,000 crores (or 1,00,000,00,00,000).

Bottom line.  I don't think the need for this change is that great and too many issues.  I'll dip into smalltalk when needed.

Thanks,
Stephen

At least until we come up with real localized numbers :)

- Bert -


On Mon, Jul 9, 2012 at 10:03 AM, Steve Thomas <[hidden email]> wrote:
On Mon, Jul 9, 2012 at 5:32 AM, Bert Freudenberg <[hidden email]> 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



_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev