Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * <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;
    }
}