Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: save to Use DecimalFormatter directly?

 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all;

i convert the string array to a Contractor object and i want to also convert the hourly charge string "$44.88" to double value 44.88 and state that this value in Dollar currency. so in the adapter class i will directy DecimalFormatter class with new operator as following:

DecimalFormatter formater = new DecimalFormatter("$0.0");

and then parse and format the string comming from database and return from client.

But the java doc for DecimalFormatter stats that don't use this idea.

anyone use this idea ???

Best regards.
 
Karol Wiszowaty
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

since in this assignment there is no need to convert hourly charge to number format (because it isn't used at all) I let it as String in my Contractor class.
Another reason is that there is no given format of this field with currency and we don't know if there can be other currencies.
 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi;

and thunk for you response; also i attempt to use it in the JTable sort column. but i will delete this idea and don't provide sort by JTable column click for this column.


regards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic