java - How convert the char ' to \' in android? -


is possible convert string "hello i'm boss" "hello i\'m boss" how can please

my problem convert ' \'

somebody have idea please??

string a="hello i'm boss"; 

i need

result="hello i\'m boss" 

thanks

you may use replace follows:

string result = a.replace("'","\\'"); 

note original string a not affected operation.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -