Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Convert decimal values to english text

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Convert decimal values to english text

    Hi
    I'm looking for a method that could translate decimal values to string,english text. For example currency values.
    600.50 so it should read as "six hundred and 50".
    Most of the method that I found can only read for integer.
    Can anyone give me an idea or suggestion how can I do this?
    Thank you


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Convert decimal values to english text

    How would you say: 600.051?

    You could cast a double to int to get the 600.
    How may decimal places do you want to handle?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Convert decimal values to english text

    Please read the forum rules...your other duplicate post has been removed.

  4. #4
    Junior Member
    Join Date
    May 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Convert decimal values to english text

    Quote Originally Posted by Norm View Post
    How would you say: 600.051?

    You could cast a double to int to get the 600.
    How may decimal places do you want to handle?
    I only want to handle two decimal place because i'm using this for converting currency. It would be six hundred and fifty one.
    By the way,I found a solution using java.text.DecimalFormat.
    Thank you for you help,I really appreciate it.

  5. #5
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Convert decimal values to english text

    Quote Originally Posted by tqa View Post
    600.50 so it should read as "six hundred and 50".
    What about 624.50? Would that be six hundred and twenty four and fifty?
    Improving the world one idiot at a time!

  6. #6
    Junior Member
    Join Date
    May 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Convert decimal values to english text

    As I want to use it for currency, so I would like it to be six hundred and twenty four dollar and fifty sent.

Similar Threads

  1. Convert Int to Doubel value without exponents and decimal value.
    By project25_java in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 1st, 2011, 09:36 PM
  2. In jsp page After decimal i need only 2 values(for ex:477.74)
    By shashib09 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: August 23rd, 2011, 06:00 AM
  3. Convert Text files to XML
    By HelloAll in forum Java Theory & Questions
    Replies: 1
    Last Post: February 2nd, 2011, 05:01 AM
  4. Convert text to excel
    By mamta_techie in forum JDBC & Databases
    Replies: 1
    Last Post: December 27th, 2010, 12:15 PM
  5. JTextField getting text values
    By The_Mexican in forum What's Wrong With My Code?
    Replies: 8
    Last Post: November 18th, 2010, 05:41 PM

Tags for this Thread