Java Utililty Methods Javascript String Unescape

List of utility methods to do Javascript String Unescape

Description

The list of methods to do Javascript String Unescape are organized into topic(s).

Method

StringunescapeJavaScript(String value)
unescape Java Script
return unescapeJava(value);
StringunescapeJavascriptParam(String s)
This function is used to convert a URL friendly string which was encoded using the Javascript escape function into a normal Java String.
StringBuffer sbuf = new StringBuffer();
int l = s.length();
int ch = -1;
int b, sumb = 0;
for (int i = 0, more = -1; i < l; i++) {
    switch (ch = s.charAt(i)) {
    case '%':
        ch = s.charAt(++i);
...
StringunescapeJavaScriptString(String string)
Unescape JS strings and return them, surrounded by single quotes.
StringBuilder ret = new StringBuilder(string.length()).append('\'');
for (int i = 0; i < string.length(); i++) {
    char chr = string.charAt(i);
    switch (chr) {
    case '\b':
        ret.append("\\b");
        break;
    case '\f':
...
StringunescapeJavaString(String st)
Unescapes a string that contains standard Java escape sequences.
if (st == null) {
    return null;
StringBuilder sb = new StringBuilder(st.length());
for (int i = 0; i < st.length(); i++) {
    char ch = st.charAt(i);
    if (ch == '\\') {
        char nextChar = (i == st.length() - 1) ? '\\' : st.charAt(i + 1);
...
StringunescapeJavaString(String str)

Unescapes any Java literals found in the String.

For example, it will turn a sequence of '\' and 'n' into a newline character, unless the '\' is preceded by another '\'.

A null string input has no effect.

if (str == null) {
    return null;
StringBuffer out = new StringBuffer();
int sz = str.length();
StringBuffer unicode = new StringBuffer(4);
boolean hadSlash = false;
boolean inUnicode = false;
...