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

Method processBracketedTokens

code/src/java/pcgen/io/ExportHandler.java:1169–1198  ·  view source on GitHub ↗

Helper method to process the math for Knowledge (xx) types of tokens @param str String to process @param aPC PC we are exporting @return Processed string

(String str, PlayerCharacter aPC)

Source from the content-addressed store, hash-verified

1167 * @return Processed string
1168 */
1169 private String processBracketedTokens(String str, PlayerCharacter aPC)
1170 {
1171 while (str.lastIndexOf('(') != -1)
1172 {
1173 int x = CoreUtility.innerMostStringStart(str);
1174 int y = CoreUtility.innerMostStringEnd(str);
1175
1176 // If the end is before the start we have a problem
1177 if (y < x)
1178 {
1179 // This was breaking some homebrew sheets. [Felipe - 13-may-03]
1180 Logging.debugPrint(
1181 "End is before start for string processing. We are skipping the processing of this item.");
1182 break;
1183 }
1184
1185 String bString = str.substring(x + 1, y);
1186
1187 // This will treat Knowledge (xx) kind of token
1188 if ((x > 0) && (str.charAt(x - 1) == ' ') && ((str.charAt(y + 1) == '.') || (y == (str.length() - 1))))
1189 {
1190 str = str.substring(0, x) + "[" + bString + "]" + str.substring(y + 1);
1191 }
1192 else
1193 {
1194 str = str.substring(0, x) + mathMode(bString, aPC) + str.substring(y + 1);
1195 }
1196 }
1197 return str;
1198 }
1199
1200 /**
1201 * Helper class to output normal text

Callers 1

mathModeMethod · 0.95

Calls 5

innerMostStringStartMethod · 0.95
innerMostStringEndMethod · 0.95
debugPrintMethod · 0.95
mathModeMethod · 0.95
lastIndexOfMethod · 0.65

Tested by

no test coverage detected