Here you can find the source of unescapeString(String text)
Effectively un-escapes a string, performs the reverse of #escapeString(String) .
Parameter | Description |
---|---|
text | a parameter |
public static String unescapeString(String text)
//package com.java2s; public class Main { /**/*from w ww . ja v a 2 s . co m*/ * <p>Effectively un-escapes a string, performs the reverse of {@link #escapeString(String)}.</p> * * @param text * @return {@link String} */ public static String unescapeString(String text) { String unescaped = text.replaceAll("\\\\n", "\n"); unescaped = unescaped.replaceAll("\\\\N", "\n"); unescaped = unescaped.replaceAll("\\\\\\\\", "\\\\"); unescaped = unescaped.replaceAll("\\\\,", ","); unescaped = unescaped.replaceAll("\\\\;", ";"); unescaped = unescaped.replaceAll("\\\\:", ":"); return unescaped; } }