Here you can find the source of unescape(String theValue)
Unescapes a string according to the rules for parameter escaping specified in the <a href="http://www.hl7.org/implement/standards/fhir/search.html#escaping">FHIR Specification Escaping Section</a>
public static String unescape(String theValue)
//package com.java2s; /*/* w ww .j a v a 2 s. com*/ * #%L * HAPI FHIR - Core Library * %% * Copyright (C) 2014 - 2016 University Health Network * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class Main { /** * Unescapes a string according to the rules for parameter escaping specified in the <a href="http://www.hl7.org/implement/standards/fhir/search.html#escaping">FHIR Specification Escaping * Section</a> */ public static String unescape(String theValue) { if (theValue == null) { return theValue; } if (theValue.indexOf('\\') == -1) { return theValue; } StringBuilder b = new StringBuilder(); for (int i = 0; i < theValue.length(); i++) { char next = theValue.charAt(i); if (next == '\\') { if (i == theValue.length() - 1) { b.append(next); } else { switch (theValue.charAt(i + 1)) { case '$': case ',': case '|': case '\\': continue; default: b.append(next); } } } else { b.append(next); } } return b.toString(); } }