Here you can find the source of substituteSymbol(String text, String symbol, String value)
Parameter | Description |
---|---|
text | the initial text. |
symbol | the string to be substituted. |
value | the string that the "symbol" will be substituted with, in the "text" (all occurences). |
public static String substituteSymbol(String text, String symbol, String value)
//package com.java2s; // jSMSEngine is distributed under the LGPL license. public class Main { /**/*from ww w . j a v a 2s . c o m*/ String substitution routine. @param text the initial text. @param symbol the string to be substituted. @param value the string that the "symbol" will be substituted with, in the "text" (all occurences). @return the changed text. */ public static String substituteSymbol(String text, String symbol, String value) { StringBuffer buffer; while (text.indexOf(symbol) >= 0) { buffer = new StringBuffer(text); buffer.replace(text.indexOf(symbol), text.indexOf(symbol) + symbol.length(), value); text = buffer.toString(); } return text; } }