user11975102
user11975102

Reputation:

Why can't I replace "'" to single quote

Why can't I replace " & # 3 9 ; " to single quote , I wrote this code but doesn't work.

Code

String originalText = "don't";
originalText = originalText.replace("'", "\'");

The result is showing dont but I want it to be don't

I set spaces between & # 3 9 ; because if I remove it will hide.

Upvotes: 0

Views: 56

Answers (1)

sanjeev
sanjeev

Reputation: 1675

Well if you have trouble converting the HTML ASCII's it's advisable to use,

Html.fromHtml("Don't");

Source:

  1. Is there a quick way to recognize HTML ASCII codes in a String or TextView?

  2. Documentation

Upvotes: 1

Related Questions