MCPcopy Create free account
hub / github.com/PCGen/pcgen / replaceVariables

Method replaceVariables

code/src/java/pcgen/io/ExportHandler.java:392–407  ·  view source on GitHub ↗
(String expr, Map<Object, Object> variables)

Source from the content-addressed store, hash-verified

390 }
391
392 private static String replaceVariables(String expr, Map<Object, Object> variables)
393 {
394 List<Object> keys = new ArrayList<>(variables.keySet());
395 keys.sort(new VariableComparator());
396
397 for (final Object anObject : keys)
398 {
399 if (anObject != null)
400 {
401 final String fString = anObject.toString();
402 final String rString = variables.get(fString).toString();
403 expr = expr.replaceAll(Pattern.quote(fString), rString);
404 }
405 }
406 return expr;
407 }
408
409 /**
410 * Helper method to evaluate an expression, used by OIF and IIF tokens

Callers 3

evaluateExpressionMethod · 0.95
evaluateIIFChildrenMethod · 0.95
processLoopMethod · 0.95

Calls 5

toStringMethod · 0.65
getMethod · 0.65
keySetMethod · 0.45
sortMethod · 0.45
replaceAllMethod · 0.45

Tested by

no test coverage detected