Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2011
    Posts
    24
    Rep Power
    0

    Default String manipulation

    Hi,

    I should convert a string, for eg; "boy"(input) into boy(i.e;in the output with out double quotes). Can someone help me on this?

    thanks

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    If the double-quotes are actually part of the input String, you can remove them using the String.substring(..) method to extract the substring starting at the second character (index 1) and ending at the length-1 character.

  3. #3
    Join Date
    Jun 2011
    Posts
    24
    Rep Power
    0

    Default

    thanks for your reply..
    This can be done, if my input is one string, Since I know the size. But, I have 10,000 strings in a file and i need to remove the double quotes for every string. After removing double quotes, I need to compare the string without double quotes with the string from other file. Is their any possibility for this?

  4. #4
    acmohan is offline Member
    Join Date
    Jul 2011
    Posts
    26
    Rep Power
    0

    Default

    If you just want to remove double quotes hope you can use "replace" in string,which will help you out.and just compare with other strings.

  5. #5
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    Quote Originally Posted by lakshmibvaraprasad View Post
    thanks for your reply..
    This can be done, if my input is one string, Since I know the size. But, I have 10,000 strings in a file and i need to remove the double quotes for every string. After removing double quotes, I need to compare the string without double quotes with the string from other file. Is their any possibility for this?
    Well you can either read the strings from the file and remove the double quotes from them one by one (then write them out to another file?), or, as acmohan suggested, read the whole file as a single string and replace the double quotes with empty strings. This assumes that you can read the file as a single string and that there are no double quotes in it that you don't want to remove.

    You haven't supplied enough information to give a precise answer. If you explain what you're trying to achieve more exactly, you might get more useful answers...

Similar Threads

  1. String manipulation
    By i4ba1 in forum Advanced Java
    Replies: 2
    Last Post: 12-22-2010, 08:53 AM
  2. String Manipulation
    By tmotse in forum New To Java
    Replies: 1
    Last Post: 10-14-2010, 01:25 PM
  3. Help needed with string manipulation
    By stringkilla in forum New To Java
    Replies: 47
    Last Post: 09-07-2010, 03:25 AM
  4. String manipulation example (Title case)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 09:04 AM
  5. String Manipulation Task
    By hiranya in forum New To Java
    Replies: 1
    Last Post: 11-19-2007, 11:07 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
  •