Results 1 to 4 of 4

Thread: useDelimiter

  1. #1
    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    Default useDelimiter

    Hello,

    I want to read data out of a file by means of a Scanner object whereby the delimiter contains the word "part".
    Is there a way to keep the delimiter in the resulting data?
    I am using the word "part" in de delimiter, however this word could not be found in the resulting data.

    Best regards,
    Arnold

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: useDelimiter

    Hi,
    read the complete line and use a StringTokenizer to split it up.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    Default Re: useDelimiter

    Hi,

    unfortunately, with a StringTokenize, I can not split by means of a whole word ("part" for instance) nor an regular expression.

    Any solution ?

    best regards

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default Re: useDelimiter

    Use split() then, and append the delimiter onto the end of all but the last token.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 5
    Last Post: 11-08-2012, 08:48 PM
  2. File IO & useDelimiter
    By alihht in forum New To Java
    Replies: 1
    Last Post: 03-28-2011, 09:59 AM
  3. useDelimiter usage
    By reis3k in forum New To Java
    Replies: 4
    Last Post: 12-24-2009, 12:01 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
  •