Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By Tolls

Thread: How to add multiple delimiters in split()?

  1. #1
    rahul405804 is offline Member
    Join Date
    Apr 2012
    Posts
    14
    Rep Power
    0

    Thumbs up How to add multiple delimiters in split()?

    I need to split words seperated by space/multiple spaces/new line .

    String temp[] = stringName.split(delimiter);

    How to specify multiple delimiters in one split() method? , or is there a way to specifiy in OR condition?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: How to add multiple delimiters in split()?

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    rahul405804 is offline Member
    Join Date
    Apr 2012
    Posts
    14
    Rep Power
    0

    Default Re: How to add multiple delimiters in split()?

    How to make use of regular expressions inside split()?

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: How to add multiple delimiters in split()?

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    rahul405804 is offline Member
    Join Date
    Apr 2012
    Posts
    14
    Rep Power
    0

    Default Re: How to add multiple delimiters in split()?

    So,
    Whether I should give a regular expression in place of string inside split method?

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

    Default Re: How to add multiple delimiters in split()?

    The String supplied to the split() method is a regex.
    DarrylBurke likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    rahul405804 is offline Member
    Join Date
    Apr 2012
    Posts
    14
    Rep Power
    0

    Default Re: How to add multiple delimiters in split()?

    Thanks for the reply! Got it..

Similar Threads

  1. Replies: 5
    Last Post: 11-04-2009, 02:25 AM
  2. parsing multiple delimiters
    By meshhat in forum New To Java
    Replies: 3
    Last Post: 04-19-2009, 12:51 AM
  3. How to split a String using split function
    By Java Tip in forum java.lang
    Replies: 4
    Last Post: 04-17-2009, 08:27 PM
  4. Replies: 3
    Last Post: 12-17-2007, 02:35 AM
  5. How to split a String using split function
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 09:32 PM

Tags for this Thread

Posting Permissions

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