Results 1 to 6 of 6
  1. #1
    mhye is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default split square brackets [].

    Hi,
    I have a string like that

    [Wright, Jeff (VI), 1988 NFL Draft (1988) , 1990 AFC Championship Game, 1992 AFC Championship Game]

    I want to split square brackets [] from string
    How can i do ?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,969
    Rep Power
    8

    Default

    You mean you just want to remove them?

    Try either String.substring() or String.removeAll().

    The API is your friend: Java Platform SE 6
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    JavaHater is offline Senior Member
    Join Date
    Dec 2010
    Posts
    165
    Rep Power
    4

    Default

    Quote Originally Posted by mhye View Post
    Hi,
    I have a string like that

    [Wright, Jeff (VI), 1988 NFL Draft (1988) , 1990 AFC Championship Game, 1992 AFC Championship Game]

    I want to split square brackets [] from string
    How can i do ?
    what exactly did you want to get from that string? describe your problems clearly

  4. #4
    mhye is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default

    Text given like that

    [Wright, Jeff (VI), 1988 NFL Draft (1988) , 1990 AFC Championship Game, 1992 AFC Championship Game]

    and i want to it without square brackets, like that

    Wright, Jeff (VI), 1988 NFL Draft (1988) , 1990 AFC Championship Game, 1992 AFC Championship Game

    how can i do that

  5. #5
    JavaHater is offline Senior Member
    Join Date
    Dec 2010
    Posts
    165
    Rep Power
    4

    Default

    then use replaceAll()
    Java Code:
    string.replaceAll("\\[|\\]","");

  6. #6
    mhye is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

Similar Threads

  1. use of <> brackets
    By dqlevitt in forum New To Java
    Replies: 3
    Last Post: 05-27-2010, 09:34 PM
  2. Arrowhead brackets
    By dushmantha.e in forum New To Java
    Replies: 5
    Last Post: 02-14-2010, 09:08 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. Bracket help - can't find the missing brackets.
    By Z E P H Y R in forum New To Java
    Replies: 0
    Last Post: 03-17-2009, 10:26 PM
  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

Posting Permissions

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