## oorexx-users

 [Oorexx-users] Formatting a decimal number? From: Oliver Sims - 2013-05-08 16:09:15 Attachments: Message as HTML ```I want to format decimal numbers of between 3 and 9 digits so that they have the following format: x,xxx,xxx.xx For example: 123 ==> 1.23 123456 ==> 1,234.56 123456789 ==> 1,234,567.89 etc. I can do it with a little routine, but after some searching, I've failed to find an easy way to do it using one of the many ooRexx formatting functions. Is there an easy way? -- Oliver Sims ```
 Re: [Oorexx-users] Formatting a decimal number? From: Mark Miesfeld - 2013-05-08 16:51:54 Attachments: Message as HTML ```Hi Oliver, There is the format method of the String class and a similar format() built in function. I've never used them much and didn't find them too easy to use. Once you understand them, they are probably easy. In the incubator is an implementation of a decimal formatting class: svn+ssh://miesfeld@.../p/oorexx/code-0/incubator/decimalFormat written by Lee. I've never tried that at all and don't know how easy it is to use. -- Mark Miesfeld On Wed, May 8, 2013 at 10:08 AM, Oliver Sims < oliver.sims@...> wrote: > ** > I want to format decimal numbers of between 3 and 9 digits so that they > have the following format: > x,xxx,xxx.xx > For example: > 123 ==> 1.23 > 123456 ==> 1,234.56 > 123456789 ==> 1,234,567.89 > etc. > > I can do it with a little routine, but after some searching, I've failed > to find an easy way to do it using one of the many ooRexx formatting > functions. > Is there an easy way? > > -- > Oliver Sims > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their applications. This 200-page book is written by three acclaimed > leaders in the field. The early access version is available now. > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may > _______________________________________________ > Oorexx-users mailing list > Oorexx-users@... > https://lists.sourceforge.net/lists/listinfo/oorexx-users > > ```
 Re: [Oorexx-users] Formatting a decimal number? From: Oliver Sims - 2013-05-08 18:18:25 Attachments: Message as HTML ```DecimalFormat looks really excellent! Puts in commas and trailing zeros plus lots more. I did play around with format and several other string and parse functions, but in the end built a little function that did what I wanted - but it's very specific to my immediate needs. What's the status of decimalFormat? Can I expect to see it rolled into ooRexx at some time, or made generally available? I'd be nice to use it for the Guide. The only thing I'd like to see added is an option to treat a number *as if* it had two decimal places, so formatting "123456" produces "1,234.56" or \$1,234.56". The rationale for this is that money amounts are often stored in a database as some number of cents. The only time they're expressed as dollars and cents is when they're presented on some form of user interface (screen/printout/etc.). So presenting 123456 cents as \$1,234.56 needs the "." to be inserted in the right place. But then, of course, all that needs is for the cents to be divided by 100 (or a "." inserted in the right place) before using DecimalFormat... -- Oliver Sims _____ From: Mark Miesfeld [mailto:miesfeld@...] Sent: 08 May 2013 16:52 To: Open Object Rexx Users Subject: Re: [Oorexx-users] Formatting a decimal number? Hi Oliver, There is the format method of the String class and a similar format() built in function. I've never used them much and didn't find them too easy to use. Once you understand them, they are probably easy. In the incubator is an implementation of a decimal formatting class: svn+ssh://miesfeld@.../p/oorexx/code-0/incubator/decimalFormat written by Lee. I've never tried that at all and don't know how easy it is to use. -- Mark Miesfeld On Wed, May 8, 2013 at 10:08 AM, Oliver Sims wrote: I want to format decimal numbers of between 3 and 9 digits so that they have the following format: x,xxx,xxx.xx For example: 123 ==> 1.23 123456 ==> 1,234.56 123456789 ==> 1,234,567.89 etc. I can do it with a little routine, but after some searching, I've failed to find an easy way to do it using one of the many ooRexx formatting functions. Is there an easy way? -- Oliver Sims ---------------------------------------------------------------------------- -- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ Oorexx-users mailing list Oorexx-users@... https://lists.sourceforge.net/lists/listinfo/oorexx-users ```
 Re: [Oorexx-users] Formatting a decimal number? From: Mark Miesfeld - 2013-05-08 18:54:15 Attachments: Message as HTML ```On Wed, May 8, 2013 at 12:17 PM, Oliver Sims < oliver.sims@...> wrote: > ** > DecimalFormat looks really excellent! Puts in commas and trailing zeros > plus lots more. > > What's the status of decimalFormat? Can I expect to see it rolled into > ooRexx at some time, or made generally available? I'd be nice to use it for > the Guide. > The DecimalFormat class was started by a committer, Lee Peedin, who was active in RexxLa and the ooRexx project. Subsequently, for his own personal reasons, he decided to play a less active role in both RexxLa and the ooRexx project. Code in the incubator is part of the project, with the same license as any other code. It is publicly available, open source code. The state of the code is whatever you see. Whether Lee felt he was done with it or not, I don't know. But, like any software, it can probably be improved. And, as a committer, it is your privilege to improve it, fix it, or enhance it. As a committer, you could expect to see it rolled into ooRexx, if you take the imitative and make the effort to do it. Rick gave Lee some help at the time Lee was working on it, and I'm sure he expected it to be rolled into the distribution. As did I. It is similar in some respects to cvsStream.cls and mime.cls. Both of which were implemented by committers and pushed into the distribution. You should probably post on the devel list and see if anyone has any objections to including it in the distribution, as a courtesy. I doubt anyone is going to object. Then you just need to move the source code out of the incubator into main or main.4.1.fixes. And integrate it into the distribution packaging. You can ask questions on the devel for anything you are unsure of how to do. You can then push to get a release out of the door. Once you finish the steps for that, you can expect to see it in ooRexx. As a hint, if you start down this path, I would say you should move the source code into main.4.1.fixes and main. You are more likely to get a ooRexx 4.1.3 release done than get main ready for a major release. > The only thing I'd like to see added is an option to treat a number *as > if* it had two decimal places, so formatting "123456" produces "1,234.56" > or \$1,234.56". The rationale for this is that money amounts are often > stored in a database as some number of cents. The only time they're > expressed as dollars and cents is when they're presented on some form of > user interface (screen/printout/etc.). So presenting 123456 cents as > \$1,234.56 needs the "." to be inserted in the right place. > If you would like to see something added, then add it. ;-) -- Mark Miesfeld ```
 Re: [Oorexx-users] Formatting a decimal number? From: Lee Peedin - 2013-05-08 19:22:17 Attachments: Message as HTML ```I surely do NOT have any issue with this becoming part of the distribution - in fact I would consider it an honor. This was one of the last things I was actively working on before being drawn in different directions. I had done about all I knew to do to it, but as Mark says: "it can probably be improved". Lee On 5/8/2013 2:54 PM, Mark Miesfeld wrote: > On Wed, May 8, 2013 at 12:17 PM, Oliver Sims > wrote: > > DecimalFormat looks really excellent! Puts in commas and trailing zeros plus lots more. > What's the status of decimalFormat? Can I expect to see it rolled into ooRexx at some time, > or made generally available? I'd be nice to use it for the Guide. > > > The DecimalFormat class was started by a committer, Lee Peedin, who was active in RexxLa and the > ooRexx project. Subsequently, for his own personal reasons, he decided to play a less active role > in both RexxLa and the ooRexx project. > > Code in the incubator is part of the project, with the same license as any other code. It is > publicly available, open source code. The state of the code is whatever you see. Whether Lee > felt he was done with it or not, I don't know. But, like any software, it can probably be > improved. And, as a committer, it is your privilege to improve it, fix it, or enhance it. > > As a committer, you could expect to see it rolled into ooRexx, if you take the imitative and make > the effort to do it. > > Rick gave Lee some help at the time Lee was working on it, and I'm sure he expected it to be > rolled into the distribution. As did I. It is similar in some respects to cvsStream.cls and > mime.cls. Both of which were implemented by committers and pushed into the distribution. > > You should probably post on the devel list and see if anyone has any objections to including it in > the distribution, as a courtesy. I doubt anyone is going to object. Then you just need to move > the source code out of the incubator into main or main.4.1.fixes. And integrate it into the > distribution packaging. > > You can ask questions on the devel for anything you are unsure of how to do. You can then push to > get a release out of the door. Once you finish the steps for that, you can expect to see it in > ooRexx. > > As a hint, if you start down this path, I would say you should move the source code into > main.4.1.fixes and main. You are more likely to get a ooRexx 4.1.3 release done than get main > ready for a major release. > > > > The only thing I'd like to see added is an option to treat a number *as if* it had two decimal > places, so formatting "123456" produces "1,234.56" or \$1,234.56". The rationale for this is > that money amounts are often stored in a database as some number of cents. The only time > they're expressed as dollars and cents is when they're presented on some form of user > interface (screen/printout/etc.). So presenting 123456 cents as \$1,234.56 needs the "." to be > inserted in the right place. > > > If you would like to see something added, then add it. ;-) > > -- > Mark Miesfeld > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their applications. This 200-page book is written by three acclaimed > leaders in the field. The early access version is available now. > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may > > > _______________________________________________ > Oorexx-users mailing list > Oorexx-users@... > https://lists.sourceforge.net/lists/listinfo/oorexx-users ```
 Re: [Oorexx-users] Formatting a decimal number? From: Oliver Sims - 2013-05-13 21:09:43 Attachments: Message as HTML ```I'd sure like to work on it and get it committed, and I'll put it on my to-do list for when I've finished with the ooDialog Guide. Oliver _____ From: Lee Peedin [mailto:lee@...] Sent: 08 May 2013 19:04 To: oorexx-users@... Subject: Re: [Oorexx-users] Formatting a decimal number? I surely do NOT have any issue with this becoming part of the distribution - in fact I would consider it an honor. This was one of the last things I was actively working on before being drawn in different directions. I had done about all I knew to do to it, but as Mark says: "it can probably be improved". Lee On 5/8/2013 2:54 PM, Mark Miesfeld wrote: On Wed, May 8, 2013 at 12:17 PM, Oliver Sims wrote: DecimalFormat looks really excellent! Puts in commas and trailing zeros plus lots more. What's the status of decimalFormat? Can I expect to see it rolled into ooRexx at some time, or made generally available? I'd be nice to use it for the Guide. The DecimalFormat class was started by a committer, Lee Peedin, who was active in RexxLa and the ooRexx project. Subsequently, for his own personal reasons, he decided to play a less active role in both RexxLa and the ooRexx project. Code in the incubator is part of the project, with the same license as any other code. It is publicly available, open source code. The state of the code is whatever you see. Whether Lee felt he was done with it or not, I don't know. But, like any software, it can probably be improved. And, as a committer, it is your privilege to improve it, fix it, or enhance it. As a committer, you could expect to see it rolled into ooRexx, if you take the imitative and make the effort to do it. Rick gave Lee some help at the time Lee was working on it, and I'm sure he expected it to be rolled into the distribution. As did I. It is similar in some respects to cvsStream.cls and mime.cls. Both of which were implemented by committers and pushed into the distribution. You should probably post on the devel list and see if anyone has any objections to including it in the distribution, as a courtesy. I doubt anyone is going to object. Then you just need to move the source code out of the incubator into main or main.4.1.fixes. And integrate it into the distribution packaging. You can ask questions on the devel for anything you are unsure of how to do. You can then push to get a release out of the door. Once you finish the steps for that, you can expect to see it in ooRexx. As a hint, if you start down this path, I would say you should move the source code into main.4.1.fixes and main. You are more likely to get a ooRexx 4.1.3 release done than get main ready for a major release. The only thing I'd like to see added is an option to treat a number *as if* it had two decimal places, so formatting "123456" produces "1,234.56" or \$1,234.56". The rationale for this is that money amounts are often stored in a database as some number of cents. The only time they're expressed as dollars and cents is when they're presented on some form of user interface (screen/printout/etc.). So presenting 123456 cents as \$1,234.56 needs the "." to be inserted in the right place. If you would like to see something added, then add it. ;-) -- Mark Miesfeld ---------------------------------------------------------------------------- -- Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ Oorexx-users mailing list Oorexx-users@... https://lists.sourceforge.net/lists/listinfo/oorexx-users ```
 Re: [Oorexx-users] Formatting a decimal number? From: hakan - 2013-05-08 19:39:22 Attachments: Message as HTML ```Don't forget us that use 1 234,56 SEK , so maybe the ideal situation is a (built in) function that use the national settings of the OS ! /hex ----- Ursprungligt Meddelande ----- Från: Oliver Sims Till: 'Open Object Rexx Users' Kopia: Datum: onsdag, 08 maj 2013 20:18 Ämne: Re: [Oorexx-users] Formatting a decimal number? DecimalFormat looks really excellent! Puts in commas and trailing zeros plus lots more. I did play around with format and several other string and parse functions, but in the end built a little function that did what I wanted - but it's very specific to my immediate needs. What's the status of decimalFormat? Can I expect to see it rolled into ooRexx at some time, or made generally available? I'd be nice to use it for the Guide. The only thing I'd like to see added is an option to treat a number *as if* it had two decimal places, so formatting "123456" produces "1,234.56" or \$1,234.56". The rationale for this is that money amounts are often stored in a database as some number of cents. The only time they're expressed as dollars and cents is when they're presented on some form of user interface (screen/printout/etc.). So presenting 123456 cents as \$1,234.56 needs the "." to be inserted in the right place. But then, of course, all that needs is for the cents to be divided by 100 (or a "." inserted in the right place) before using DecimalFormat... -- Oliver Sims From: Mark Miesfeld [mailto:miesfeld@...] Sent: 08 May 2013 16:52 To: Open Object Rexx Users Subject: Re: [Oorexx-users] Formatting a decimal number? Hi Oliver, There is the format method of the String class and a similar format() built in function. I've never used them much and didn't find them too easy to use. Once you understand them, they are probably easy. In the incubator is an implementation of a decimal formatting class: svn+ssh://miesfeld@.../p/oorexx/code-0/incubator/decimalFormat written by Lee. I've never tried that at all and don't know how easy it is to use. -- Mark Miesfeld On Wed, May 8, 2013 at 10:08 AM, Oliver Sims wrote: I want to format decimal numbers of between 3 and 9 digits so that they have the following format: x,xxx,xxx.xx For example: 123 ==> 1.23 123456 ==> 1,234.56 123456789 ==> 1,234,567.89 etc. I can do it with a little routine, but after some searching, I've failed to find an easy way to do it using one of the many ooRexx formatting functions. Is there an easy way? -- Oliver Sims ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ Oorexx-users mailing list Oorexx-users@... https://lists.sourceforge.net/lists/listinfo/oorexx-users ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may _______________________________________________ Oorexx-users mailing list Oorexx-users@... https://lists.sourceforge.net/lists/listinfo/oorexx-users```
 Re: [Oorexx-users] Formatting a decimal number? From: Earl D Hodil - 2013-05-08 21:32:25 Attachments: Message as HTML ```On 5/8/2013 12:51 PM, Mark Miesfeld wrote: > Hi Oliver, > > There is the format method of the String class and a similar format() > built in function. I've never used them much and didn't find them too > easy to use. Once you understand them, they are probably easy. > > In the incubator is an implementation of a decimal formatting class: > > svn+ssh://miesfeld@.../p/oorexx/code-0/incubator/decimalFormat > ; > > written by Lee. I've never tried that at all and don't know how easy > it is to use. > > -- > Mark Miesfeld > > > > On Wed, May 8, 2013 at 10:08 AM, Oliver Sims > > wrote: > > I want to format decimal numbers of between 3 and 9 digits so that > they have the following format: > x,xxx,xxx.xx > For example: > 123 ==> 1.23 > 123456 ==> 1,234.56 > 123456789 ==> 1,234,567.89 > etc. > I can do it with a little routine, but after some searching, I've > failed to find an easy way to do it using one of the many ooRexx > formatting functions. > Is there an easy way? > -- > Oliver Sims > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their applications. This 200-page book is written by three acclaimed > leaders in the field. The early access version is available now. > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may > _______________________________________________ > Oorexx-users mailing list > Oorexx-users@... > > https://lists.sourceforge.net/lists/listinfo/oorexx-users > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their applications. This 200-page book is written by three acclaimed > leaders in the field. The early access version is available now. > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may > > > _______________________________________________ > Oorexx-users mailing list > Oorexx-users@... > https://lists.sourceforge.net/lists/listinfo/oorexx-users Might I put my two cents in and suggest that whoever is developing the decimalFormat class consider using the picture characters of old (as in COBOL and PL/I) for the format string. I put a similar function into REXXTOOLS on the mainframe and it has been very popular. Earl Hodil Open Software Technologies ```
 Re: [Oorexx-users] Formatting a decimal number? From: Staffan Tylen - 2013-05-09 08:57:22 Attachments: Message as HTML ```Here are another two cents: ensure that any further development considers international standards, not only US (unless this is already catered for in the currently available class, I haven't seen it). Staffan On Wed, May 8, 2013 at 11:19 PM, Earl D Hodil wrote: > On 5/8/2013 12:51 PM, Mark Miesfeld wrote: > > Hi Oliver, > > There is the format method of the String class and a similar format() > built in function. I've never used them much and didn't find them too easy > to use. Once you understand them, they are probably easy. > > In the incubator is an implementation of a decimal formatting class: > > svn+ssh:// > miesfeld@.../p/oorexx/code-0/incubator/decimalFormat > > written by Lee. I've never tried that at all and don't know how easy it > is to use. > > -- > Mark Miesfeld > > > > On Wed, May 8, 2013 at 10:08 AM, Oliver Sims < > oliver.sims@...> wrote: > >> I want to format decimal numbers of between 3 and 9 digits so that they >> have the following format: >> x,xxx,xxx.xx >> For example: >> 123 ==> 1.23 >> 123456 ==> 1,234.56 >> 123456789 ==> 1,234,567.89 >> etc. >> >> I can do it with a little routine, but after some searching, I've failed >> to find an easy way to do it using one of the many ooRexx formatting >> functions. >> Is there an easy way? >> >> -- >> Oliver Sims >> >> >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and >> their applications. This 200-page book is written by three acclaimed >> leaders in the field. The early access version is available now. >> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may >> _______________________________________________ >> Oorexx-users mailing list >> Oorexx-users@... >> https://lists.sourceforge.net/lists/listinfo/oorexx-users >> >> > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their applications. This 200-page book is written by three acclaimed > leaders in the field. The early access version is available now. > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may > > > > _______________________________________________ > Oorexx-users mailing listOorexx-users@...nethttps://lists.sourceforge.net/lists/listinfo/oorexx-users > > Might I put my two cents in and suggest that whoever is developing the > decimalFormat class consider using the picture characters of old (as in > COBOL and PL/I) for the format string. I put a similar function into > REXXTOOLS on the mainframe and it has been very popular. > > Earl Hodil > Open Software Technologies > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and > their applications. This 200-page book is written by three acclaimed > leaders in the field. The early access version is available now. > Download your free book today! http://p.sf.net/sfu/neotech_d2d_may > _______________________________________________ > Oorexx-users mailing list > Oorexx-users@... > https://lists.sourceforge.net/lists/listinfo/oorexx-users > > ```