Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 86
Registered: ‎07-21-2009
My Device: Not Specified
Accepted Solution

number format, floating point

Given a pattern "000000.000" and a double with value 123.78

I need output of  "000123.780".

Overall I need to support format descriptors f,g,E. 

 

I have looked at the threads on this and it seems that

MessageFormatter does not support numeric classes. 

( http://tinyurl.com/ygyju49 )

 

One message I saw ( http://tinyurl.com/yldkun4 )

said to check for custom formatting methods here...

http://www.horstmann.com/corejava/Format.java

 

This code has a license which is non-commercial only

(and it's sun, they don't mess around.)

It would be a substantial pain to hand roll this code.

 

Tips, code, bsd open source refs? 

 

 

Help me please!

thanks so much.

lucidbee.

Developer
Posts: 86
Registered: ‎07-21-2009
My Device: Not Specified

Re: number format, floating point

Any help out there?

 

Please, if there is something wrong with the way I have posted, let me know!

I will fix it ASAP. 

I would just like a little assistance here. 

 

 

thanks, lucidbee

Developer
Posts: 86
Registered: ‎07-21-2009
My Device: Not Specified

Re: number format, floating point

Developer
Posts: 499
Registered: ‎06-24-2008
My Device: Not Specified

Re: number format, floating point

I take it

 

Formatter.formatNumber(double number, int decimals)
          Formats a decimal number using locale-specific rules, with the specified number of decimals.

 

...didnt quite fit your requirement?

Developer
Posts: 86
Registered: ‎07-21-2009
My Device: Not Specified

Re: number format, floating point

Part of the spec I am working with has pattern format strings using

'#', '0', and more.

I found another link that supports much of what 'DecimalFormat' class supports, with patterns:

 

http://www.java2s.com/Open-Source/Java-Document/Ajax/GWT/com/google/gwt/i18n/client/NumberFormat.jav...

 

 

Developer
Posts: 64
Registered: ‎05-09-2009
My Device: Not Specified

Re: number format, floating point

[ Edited ]

Were you successful in modifying the example?

If you were would you mind to share it?

New Contributor
Posts: 6
Registered: ‎02-21-2013
My Device: 9810
My Carrier: movistar

Re: number format, floating point

how to i can implement this you can shared one example???
wthatsapp +584248144402