This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
any build in function can convert a number 8000000000000 into 8, 000, 000, 000, 000 thanks!
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1865
posted
0
hi Jackie, you can use NumberFormatter for the purpose. here is a link for SUN's tutorial about it. also here is a sample code i tried with it,
the output was, Output:8,000,000,000 the only problem i found was- format() method doesn't accept long as simple argument even if we cast 8000000000 to long explicitly, it expects integer argument instead so i had to use double to specify that big value.. hope this helps. regards maulin
Maulin, thanks so much for the prompt reply. However, I would like the number to be 8, 000, 000, 000 (with space) Also, for a string: "testingmessingtestingmessageasdasdasasdasasd" how can i arbitrary break the string into 10 character with a space in between? Thanks!
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1865
posted
0
hi Jackie, say you want to put a space at character position 'pos' and you have the string 'str' then you can write the following to achieve that, str = "8000000000"; char space = ' '; str = new StringBuffer(str).insert(pos,space).toString(); please let me know if this works. ive not tried this code... regards maulin