Converting a String and getting a Complex number by Parsing the string.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stanlopilolo
    New Member
    • Mar 2008
    • 1

    #1

    Converting a String and getting a Complex number by Parsing the string.

    Here,
    I have a string inside a static method. Something like "4.0+5.0i"
    and I want to parse it, to -at the end of the day-get a complex number 4+5i

    How exactly can I get to this? Spliting d spring into string arrays, then to double, using Double.parseDou ble?
    then ....

    Please I'm new to programming, and don't want to lose my mind figuring it out, lol
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by stanlopilolo
    Here,
    I have a string inside a static method. Something like "4.0+5.0i"
    and I want to parse it, to -at the end of the day-get a complex number 4+5i

    How exactly can I get to this? Spliting d spring into string arrays, then to double, using Double.parseDou ble?
    then ....

    Please I'm new to programming, and don't want to lose my mind figuring it out, lol
    There is no complex number datatype in the standard Java classes. Have you written your own complex number class?

    Comment

    Working...