Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Line string problem

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Line string problem

    hi,

    i have problem dealing with a string in a line,
    for example i have the following lines in a .txt file
    ussdserver link from host /127.0.0.1:38978(account smpp34) is up|smpp34|2012-10-28 17:02:19
    ussdserver link from host localhost/127.0.0.1:8088(account callme) is up|callme|2012-10-28 17:02:20
    i need from my code to get the word after the "account" word (in the first line its smpp34) and the word "up" (after the is word)

    pls help how i can do it?
    i thought about the String charAt() method but it dont work here because the words that i need can be in different places like in the example

    thanks,


  2. #2
    Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    84
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: Line string problem

    I think you maybe can use 'contains' to look for the lines that have a "account" in the line.
    And after that you can use the split() functiion to grab the word you need.

    Good luck.

Similar Threads

  1. Replacing parts of a String using line.replaceAll
    By brandonSMC in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 27th, 2012, 04:07 PM
  2. Problem with Reading very long line using bufferedReader
    By nicool in forum File I/O & Other I/O Streams
    Replies: 6
    Last Post: November 7th, 2011, 12:32 PM
  3. Replies: 10
    Last Post: September 16th, 2011, 07:49 PM
  4. Replies: 2
    Last Post: December 22nd, 2010, 08:21 AM
  5. A problem with command line compilation
    By goodguy in forum Java Theory & Questions
    Replies: 4
    Last Post: August 2nd, 2010, 10:58 AM