Results 1 to 2 of 2
  1. #1
    Lowest0ne is offline Member
    Join Date
    Apr 2012
    Posts
    21
    Rep Power
    0

    Default Parse String quickie

    Hi all,

    I've got a file:
    Name: John Smith
    Age: 29
    Height: 6.0
    Weight: 160
    Which is meant to be used to fill the data of a class.

    What method do I use to find the first instance of " " and "toWhatever" the string from there? Thanks.

    Edit: StringBuffer?

    Edit2: Sorry all, my solution:
    Java Code:
    //bufferedReader is a succesfully opened file
    int ch;
    while ((ch = bufferedReader.read()) != -1 && ch != ' ')
      ;
    Last edited by Lowest0ne; 10-20-2012 at 04:30 PM.

  2. #2
    Join Date
    Mar 2011
    Posts
    93
    Rep Power
    0

    Default Re: Parse String quickie

    String.valueOf(char c)

    and

    String.valueOf(Object obj)

Similar Threads

  1. how to parse this string to SimpleDateFormat
    By vpillai in forum New To Java
    Replies: 2
    Last Post: 08-26-2011, 09:50 AM
  2. parse xml string
    By awallace in forum Java Applets
    Replies: 1
    Last Post: 07-27-2011, 02:01 PM
  3. Trying to parse int from string. Need help please.
    By Romally in forum New To Java
    Replies: 4
    Last Post: 11-14-2010, 09:58 PM
  4. how to Parse int to a string variable
    By raj reddy in forum Java Servlet
    Replies: 10
    Last Post: 01-09-2009, 07:41 PM
  5. how to Parse int to a string variable (pls hlp)
    By raj reddy in forum Threads and Synchronization
    Replies: 5
    Last Post: 06-10-2008, 06:32 AM

Posting Permissions

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