Results 1 to 7 of 7

Thread: String to number - Resolved

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    Tulsa,Ok
    Posts
    262

    String to number - Resolved

    Guys,

    I am having a problem converting a string over to a value like Float or double. I am teaching myself J++ right now and I am trying to convert a VB program I wrote into J++.

    I need to convert the string value that is in the edit box into a float value. I have tried to use the valueOf but it keeps telling me that there is not valueOf part of the class.

    I have tried all the examples that are listed here and cant seem to get any of them to work. MS does not seem to have the parseItem in there stuff.

    Can anyone help me out. I have not seen very much on here for J++ but its all I have to learn from right now.

    Thanks,

    Jerel
    Last edited by Phenglai; Feb 2nd, 2003 at 07:04 PM.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I have never used J++, but in plain Java, you could use...
    Code:
    float f = Float.parseFloat("2.1");
    Does that help?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    Tulsa,Ok
    Posts
    262
    No, the types dont have the parseFlost or parseDouble function in them.

    Its wierd, I cant seem to figure it out at all. If you go to msdn, they dont have help on J++ anymore there, heck they dont even have VB 6.0 hardly anymore.

    I have 4 books on J++ and none of them talk about this. They all go the other way from value to string but not string to value.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    Tulsa,Ok
    Posts
    262
    Well, I figured it out. Here it is if anyone ever needs to figure this out on J++

    Code:
    float f = Float.valueOf(String).floatValue();
    Jerel

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Same as in Java.
    BTW, J++ is a bad language to learn. It is discontinued by MS and support will go rapidly away as Sun has won the lawsuit about it against MS.

    Learn real Java or learn C#.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    Tulsa,Ok
    Posts
    262
    That is my plan but all I have is J++ right now. The forms on J++ are the precursor to the windows forms of .Net and the syntax, while not the same, is close and can give me a headstart until our company buys .net or Java. Depending on which way we turn.

    Thanks,

    Jerel

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Java is free...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width