Results 1 to 4 of 4
  1. #1
    theonly is offline Member
    Join Date
    Apr 2008
    Posts
    23
    Rep Power
    0

    Default Deleting Contractions

    Hey,

    I have a small problem. I want to delete all contractions in a string, but I can't recall how to do it.

    For examples
    a string like: "You're the best at stealing Mr. Black's pen"
    I want it to look like: "Youre the best at stealing Mr Blacks pen"

    Thanks in advance

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    try to use replaceAll(String regex, String replacement) method....

    where your regex is " \\' " and your replacement is just a blank string.... depends on you... ""
    freedom exists in the world of ideas

  3. #3
    theonly is offline Member
    Join Date
    Apr 2008
    Posts
    23
    Rep Power
    0

    Default

    Thanks for the response, but is there a method that replaces all Contractions like "-, ' , "

  4. #4
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    I can't get what you mean....

    is it (-,',)? forget the parenthesis....

    if yes, then try it.... use it as your regex....

    If nothings happened, try to post the new output if changed and not the desired result....

    Have some experiments on it....
    freedom exists in the world of ideas

Similar Threads

  1. Deleting All rows in the JTable
    By surot in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 11:44 AM
  2. Deleting a File that is opened
    By ravian in forum Advanced Java
    Replies: 6
    Last Post: 01-30-2008, 03:05 PM
  3. Deleting an empty directory
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-13-2008, 08:17 AM
  4. deleting elements
    By nalinda in forum New To Java
    Replies: 2
    Last Post: 12-06-2007, 02:42 AM
  5. Deleting certain image pixels..
    By Brightside in forum New To Java
    Replies: 1
    Last Post: 05-22-2007, 10:21 AM

Posting Permissions

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