This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Have you tried a nonsense character instead of the real commas? Look through the active threads on this forum today and find those about Unicode and Chinese. Try changing all your real commas to one of those Chinese characters they are discussing, then change it back when you extract the data. I don't know whether that will fulfill your requirements, but it isn't hard to try.
i will have to use MyString.replaceAll(",","\\,"),but finally these two backslash cancel each other and what is left is comma.
What does "two backslash cancel each other" mean? .... not sure what you want to accomplish but are you trying to change a comma into a backslash followed by a comma?
Keep in mind that a backslash has special meaning to both Java strings and regex replacement strings.
To a regex replacement string, it means that the next character is a literal -- so "\," has the same meaning as ",". If you actually mean the literal backslash, then you need to have "\\," as the regex replacement string. But.... You are not done yet.
A backslash also has special meaning in a java string. So if you want to have a literal backslash to pass to the regex, which in this case, is two literal backslashes, you need to escape that as well.... so if you mean a literal "\," as your replacement, you need to specify "\\\\," as the second parameter in your replaceAll() method call.