Here you can find the source of unescape(String value)
Parameter | Description |
---|---|
value | a parameter |
public static String unescape(String value)
//package com.java2s; //License from project: Apache License public class Main { /**//from www .jav a 2 s. co m * Unescape string * * @param value * @return */ public static String unescape(String value) { if (value == null || value.length() == 0) { return value; } StringBuffer buffer = new StringBuffer(); int pos = 0, max = value.length(); while (pos < max) { Character current = value.charAt(pos); if (current == '\\' && (pos + 1) < max) { switch (value.charAt(pos + 1)) { case '\"': buffer.append('\"'); pos += 2; break; case '\'': buffer.append('\''); pos += 2; break; case '\\': buffer.append('\\'); pos += 2; break; case '\n': buffer.append('\n'); pos += 2; break; case '\t': buffer.append('\t'); pos += 2; break; default: buffer.append(current); pos++; break; } } else { buffer.append(current); pos++; } } return buffer.toString(); } }