Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default parsing chars for an array

    hi, i'm trying to parse a char fromm a InputDialogbox, but for the life of me i am totally stuck.

    PickedLetter = JOptionPane.showInputDialog(null, "Please enter a letter: ");
    Letterpick = Character.parseChar(PickedLetter);

    appreciate any help.

    regards.

    C.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: parsing chars for an array

    Can you explain your problem? What does your code do? Is the result not what you want? What do you want the code to do?
    IF you get errors please post the full text of the error message.

  3. #3
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Re: parsing chars for an array

    i am actually fine in the rest of the data, but i was given an array of chars {'a', 'd'...random nine more}
    while the teacher showed us how do do it if actually given a letter (meaning i dont have to parse anything)
    but i just want to know how to parse a character to run a binary search on it.

    but the parseChar comes up with this error (in dos prompt):
    Cannot find symbol
    symbol : method ParseChar
    also doesnt work with ParseCharacter..

    apologies, i'm new to writing in Java forums :)

    regards.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: parsing chars for an array

    how to parse a character to run a binary search on it.
    What does "parse a character" mean? What are the results you expect?
    Cannot find symbol
    symbol : method ParseChar
    The compiler can not find the method: ParseChar
    What class is the parseChar method in? Have you looked at the API doc for the Character class?

  5. #5
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Re: parsing chars for an array

    i want it to read what ever letter is typed into the Dialog box, and identify it as a char...

    similar to Integer.parseInt() does.. but it doesnt seem to accept it.. i've been looking all over for a way to do it..

    maybe start looking for a different approach altogether..

    and as for API docs...i wouldnt know where to start :)

    but looking there anyway.. maybe class is the problem,

    hmmm...

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: parsing chars for an array

    identify it as a char.
    Look at the Character class for methods to do that.
    similar to Integer.parseInt()
    The parseInt method converts a String to an int.

    Go to the API docs, Find Character in the lower left, click it and the doc comes up in the main frame.
    Java Platform SE 6

Similar Threads

  1. Replies: 2
    Last Post: 07-21-2011, 04:46 AM
  2. Replies: 1
    Last Post: 02-07-2011, 09:22 PM
  3. create string from array of chars
    By leda in forum New To Java
    Replies: 1
    Last Post: 11-08-2010, 07:39 PM
  4. List of chars
    By SwEeTAcTioN in forum New To Java
    Replies: 8
    Last Post: 01-05-2010, 01:05 PM
  5. chars
    By whosadork in forum New To Java
    Replies: 6
    Last Post: 10-03-2008, 10:40 PM

Posting Permissions

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