reading a single string

Posted on 2004-11-03
Last Modified: 2010-03-31
I know readLine read in string and can be splted,
how can i read in a sigle at a time:
example if i have firstString secondString
How do i read them and need to split after

Question by:komlaaa
    LVL 92

    Expert Comment

    while (null!=(line=in.readLine()))
       String[] split = line.split(" ");
    LVL 1

    Assisted Solution

    LVL 37

    Accepted Solution

    If you don't want to use readLine() + split, you'll have to read character by character using read().
    Then your string stops whenever you encounter a space (in your case)
    LVL 37

    Expert Comment


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    NotAlone Challenge 20 65
    MaxSpan challenge 9 51
    fix34  challenge 9 72
    count7 challenge 12 52
    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now