Reputation: 317
I want to convert unicode string to string. I faced may method. But i did not get any useful answer for me. For example, If i send "b'day" string on server ,then i get "b’day" string from server . How to check comming string from server is string or unicode string. If you know, Please help me .
Thanks in advance
Upvotes: 1
Views: 3061
Reputation: 5176
For that you'll have to :
Then switch case
that to char to get the actual character.
String str = myString.split(" ")[0];
str = str.replace("\\","");
String[] array = str.split("u");
String stringText = "";
for(int i = 1; i < array.length; i++){
int hexValue = Integer.parseInt(array[i], 16);
stringText += (char)hexValue;
}
textView.setText(Html.fromHtml(stringText));
’
is the Html
representation for ( ' ) in Unicode
.
You can get your desired output by Html.fromHtml(stringText)
Upvotes: 1