/**
* 功能描述:替换字符串
*
* @param from
* String 原始字符串
* @param to
* String 目标字符串
* @param source
* String 母字符串
* @return String 替换后的字符串
*/
public static String replace(String from, String to, String source) {
if (source == null || from == null || to == null)
return null;
StringBuffer str = new StringBuffer("");
int index = -1;
while ((index = source.indexOf(from)) != -1) {
str.append(source.substring(0, index) + to);
source = source.substring(index + from.length());
index = source.indexOf(from);
}
str.append(source);
return str.toString();
}