Skip to content

Instantly share code, notes, and snippets.

@zdi-team
Created December 18, 2021 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdi-team/f626a1b611ea3899bae4c2cbb3cfddee to your computer and use it in GitHub Desktop.
Save zdi-team/f626a1b611ea3899bae4c2cbb3cfddee to your computer and use it in GitHub Desktop.
// resolve the variable
String varValue = resolveVariable(event, varName, buf, startPos, endPos);
if (varValue == null) {
varValue = varDefaultValue;
}
if (varValue != null) {
// recursive replace
final int varLen = varValue.length();
buf.replace(startPos, endPos, varValue);
altered = true;
int change = substitute(event, buf, startPos, varLen, priorVariables);
change = change + (varLen - (endPos - startPos));
pos += change;
bufEnd += change;
lengthChange += change;
chars = getChars(buf); // in case buffer was altered
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment