[ Back | Previous | Next ]

How to replace part of a string based on a ref. tag?

Package:
java.lang.*
Product:
JDK
Release:
1.0.2
Related Links:
General
General
General
General
General
General
General
General
General
Runtime
System
Comment:
/**
 * Insert the method's description here.
 * Creation date: (1/25/00 11:26:04 PM)
 * @return java.lang.String
 * @param tag java.lang.String
 * @param line java.lang.String
 */
public static String replaceTag(String tag, String line, String replacement) {
	int b = line.indexOf(tag);
	int e = b + tag.length();
	String begin = line.substring(0, b);
	String end = line.substring(e);
	return begin + replacement + end;
}