Here you can find the source of substitutePropertyWithIn(String propertyName, String replacementString, String evaluatedString)
Parameter | Description |
---|---|
propertyName | the property name |
replacementString | the replacement string |
evaluatedString | the evaluated string |
public static String substitutePropertyWithIn(String propertyName, String replacementString, String evaluatedString)
//package com.java2s; /******************************************************************************* * Copyright (c) 2008 Pierre-Antoine Gr?goire. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from www.ja va 2 s. co m * Pierre-Antoine Gr?goire - initial API and implementation *******************************************************************************/ public class Main { /** * Substitute property with in. * * @param propertyName * the property name * @param replacementString * the replacement string * @param evaluatedString * the evaluated string * * @return the string */ public static String substitutePropertyWithIn(String propertyName, String replacementString, String evaluatedString) { replacementString = replacementString.replace("\\", "\\\\"); return evaluatedString.replaceAll("\\$\\{" + propertyName + "\\}", replacementString); } }