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 6 of 6

Thread: Help me understand Delimiter limitations?

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help me understand Delimiter limitations?

    I'm trying to scan a string from a file that has int, words and double numbers. I want to just print the words, how do I ignore the double type numbers in the file? I was thinking this would work...

    Scanner scanner = new Scanner(line);
    scanner.useDelimiter(double);
    System.out.print(scanner.next() + " ");

    Delimiter doesn't like it when I don't have " " and a character with it.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Help me understand Delimiter limitations?

    There are 2 useDelimiter methods. One takes a Pattern as a parameter the other takes a String as a parameter. The reserved word 'double' is neither of those.
    Improving the world one idiot at a time!

  3. #3
    Junior Member
    Join Date
    Sep 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me understand Delimiter limitations?

    So can you use a delimiter to skip passed Doubles?

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Help me understand Delimiter limitations?

    Did you read my above post? One of the methods takes a Pattern as a parameter. Do you know about the Pattern class? If not, did you look in the API for information about that class. Did you do a Google search for examples?
    Improving the world one idiot at a time!

  5. #5
    Junior Member
    Join Date
    Sep 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me understand Delimiter limitations?

    A simple no would have sufficed Junky. You made me realize the importance of attitude and communication in the business world though. Even though I'm new at programming and still getting my feet wet, employer's want people who can understand one another. You did not demonstrate understanding of the fundamentals of my problem here. I asked a simple question, obviously you pointed out that you can not use double syntax with delimiter. However, instead of leading me down a dark tunnel, you could have lead me to another avenue to a solution. I'm glad I suck at programming and not with people skills. Problem solved.

  6. #6
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Help me understand Delimiter limitations?

    My post was aimed at you finding the answer for yourself instead of relying on someone spoonfeeding you the answer. As far as I am concerned those that refuse to do any research themselves and just wait for fully coded solutions suck period!
    Improving the world one idiot at a time!

Similar Threads

  1. Best way to use delimiter/other options
    By iceraven721 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: April 19th, 2013, 10:53 AM
  2. delimiter problem
    By kyanamgoutham in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: December 8th, 2012, 11:25 AM
  3. Scanner delimiter
    By NoviceJAVA in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 2nd, 2011, 06:44 PM
  4. Database Querying, Packet Size Limitations
    By aussiemcgr in forum Java Theory & Questions
    Replies: 1
    Last Post: July 25th, 2011, 03:47 PM
  5. delimiter question
    By Sterzerkmode in forum Java SE APIs
    Replies: 1
    Last Post: November 19th, 2009, 06:21 AM