Here you can find the source of unescape(String escaped, char escape)
Parameter | Description |
---|---|
escaped | a parameter |
escape | a parameter |
public static String unescape(String escaped, char escape)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w . j a v a 2 s. c om * Opposite of {@link #escape(String, char, char)} * @param escaped * @param escape * @return */ public static String unescape(String escaped, char escape) { StringBuilder sb = new StringBuilder(escaped.length()); for (int i = 0, n = escaped.length(); i < n; i++) { char c = escaped.charAt(i); if (c == escape) { i++; c = escaped.charAt(i); } sb.append(c); } return sb.toString(); } /** * Convenience for peeking at a character which might be beyond the end of * the sequence. * * @param chars * @param i * @return the char at index i, if within range, or 0 otherwise. */ public static char charAt(CharSequence chars, int i) { return i < chars.length() ? chars.charAt(i) : 0; } }