Created
November 26, 2016 06:19
-
-
Save zebulon988/0d288feae956b6c1322cb5b401cc0bbd to your computer and use it in GitHub Desktop.
java code call js method which has string params ,you should wrap the string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String wrapStringForJsCallParams(String str){ | |
if(TextUtils.isEmpty(str)) return str; | |
str = str.replaceAll("\\\\" , "\\\\\\\\"); | |
str = str.replaceAll("'" , "\\\\'"); | |
str = str.replaceAll("\"" , "\\\\\""); | |
return str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment