Java Utililty Methods List Replace

List of utility methods to do List Replace

Description

The list of methods to do List Replace are organized into topic(s).

Method

voidreplacePolUtilsName(final List npcListSqlLines, final int lineIndex, final String name)
replace Pol Utils Name
final String npcIdLine = npcListSqlLines.get(lineIndex);
int startIndex = npcIdLine.indexOf(",");
startIndex = npcIdLine.indexOf(",", startIndex + 1);
int nextQuote = npcIdLine.indexOf("'", startIndex + 2);
int endIndex = npcIdLine.indexOf(",", startIndex + 1);
if (endIndex < nextQuote) {
    endIndex = npcIdLine.indexOf(",", endIndex + 1);
final String newLine;
if (name == null) {
    newLine = npcIdLine.substring(0, startIndex + 1) + "\'\'"
            + npcIdLine.substring(endIndex, npcIdLine.length());
} else {
    newLine = npcIdLine.substring(0, startIndex + 1) + '\'' + name.replaceAll("'", "\\\\'") + '\''
            + npcIdLine.substring(endIndex, npcIdLine.length());
npcListSqlLines.set(lineIndex, newLine);
voidreplacePositions(StringBuffer c, int origLength, String string, List positions)
replace Positions
int offset = 0;
for (Iterator iter = positions.iterator(); iter.hasNext();) {
    int position = ((Integer) iter.next()).intValue();
    c.replace(offset + position, offset + position + origLength, string);
    offset += string.length() - origLength;