This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
How do you compute \\u0259 -> corresponds to a particular unicode value.
If there is no available mapping in API (I don't know if it's present) you can have all the mapping in a properties file, read it in your application, parse the String you want to check and replace them with the value configured.
ilkin esrefli wrote:I know differences between \\u0259 and \u0259.
Your first post makes it pretty clear that you don't.
Maybe I couldn't explain. Try to explain like that:
below example input value is bel\u0259
java Java2Uni bel\u0259
Ah, so you don't want to provide unicode escapes in your source code. You want to provide them at runtime and parse them yourself. Note that the escape sequence \u is not significant in java.lang.String, but rather, in string literals in the compiler.
So if you want to provide the characters '\', 'u', '0', '2', '5', '9' in a java.lang.String and convert that to a java.lang.String containing just the character 'ə', then I think you have to do it yourself. I don't think there's any built in facility to do that. You would need to recognize the '\' and 'u' characters, and then take the next 4 characters, get their int value, such as Integer.parseInt("0259", 16), and then do something like with the result, although I'm not sure if that would work in the general case, or if you'd need to use http://docs.oracle.com/javase/6/docs/api/java/lang/Character.html#toChars(int)
I think you're missing the point. "\u1234" as a String literal is not the same as a String created from characters '\', 'u', '1', '2', '3', '4', such as when reading "\u1234" from a text file. The first is interpreted by the compiler into a String with a single char in it. There's no parsing done at runtime.
The second case results in a String with the 5 characters '\', 'u', '1', '2', '3', '4' in it, which then needs to be further parsed at runtime if we want to end up with that same single-character String. This second case seems to be what the OP is asking about.