Formatting a set of NSDecimalNumber values

2012-08-10 Thread Sixten Otto
I'm working on an app where I need to take several sets of numeric values (currently stored as NSDecimalNumber), and display them in columns. Each set will have approximately the same magnitude, but the magnitude of each set may change, and I won't know ahead of time what they are. So one might be

Re: Formatting a set of NSDecimalNumber values

2012-08-10 Thread Jens Alfke
On Aug 10, 2012, at 8:58 AM, Sixten Otto hims...@sfko.com wrote: In order to make the columns line up, and to know how much space I'll need, what I'd like to do is to figure out, for each set of numbers, the width of the format I'll need. In other words, the maximum number of integer places,

Re: Formatting a set of NSDecimalNumber values

2012-08-10 Thread Kyle Sluder
On Aug 10, 2012, at 9:29 AM, Jens Alfke j...@mooseyard.com wrote: That doesn't seem like a workaround, it seems like the correct solution (although why not use the user's real locale?). Fundamentally you are trying to display and align character strings, so you have to treat the numbers as

Re: Formatting a set of NSDecimalNumber values

2012-08-10 Thread Sixten Otto
I'm definitely aware of the font issues, and those I can deal with (I think?). In particular, if I can line up the decimal separators vertically, everything else should align, as I should be able to force a font that has lining figures. My reasoning for measuring the strings in a fixed locale

Re: Formatting a set of NSDecimalNumber values

2012-08-10 Thread Sixten Otto
On Fri, Aug 10, 2012 at 10:46 AM, Kyle Sluder k...@ksluder.com wrote: Don't forget bout languages where numbers read right-to-left. Like which? (I had, shamefully, completely forgotten r-t-l text in this scheme. But some casual googling leads me to believe that Hebrew and Arabic, at least, write

Re: Formatting a set of NSDecimalNumber values

2012-08-10 Thread Jens Alfke
On Aug 10, 2012, at 10:55 AM, Sixten Otto hims...@sfko.com wrote: I could, as you say, measure the drawn sizes of the localized strings. I guess my resistance to that idea is really that I'd have to do it a couple of times (the width of the whole string, and the position of the decimal

Re: Formatting a set of NSDecimalNumber values

2012-08-10 Thread Kyle Sluder
On Fri, Aug 10, 2012, at 11:05 AM, Sixten Otto wrote: On Fri, Aug 10, 2012 at 10:46 AM, Kyle Sluder k...@ksluder.com wrote: Don't forget bout languages where numbers read right-to-left. Like which? (I had, shamefully, completely forgotten r-t-l text in this scheme. But some casual googling