MCPcopy Create free account
hub / github.com/BaseXdb/basex / replace

Method replace

basex-core/src/main/java/org/basex/util/Token.java:1101–1107  ·  view source on GitHub ↗

Replaces the specified character and returns the result token. @param token token to be checked @param search the character to be replaced @param replace the new character @return resulting token

(final byte[] token, final int search, final int replace)

Source from the content-addressed store, hash-verified

1099 * @return resulting token
1100 */
1101 public static byte[] replace(final byte[] token, final int search, final int replace) {
1102 if(!contains(token, search)) return token;
1103
1104 final TokenBuilder tb = new TokenBuilder(token.length);
1105 forEachCp(token, cp -> tb.add(cp == search ? replace : cp));
1106 return tb.finish();
1107 }
1108
1109 /**
1110 * Removes leading and trailing whitespace from the specified token.

Callers 12

addMethod · 0.95
PropClass · 0.45
uriToClasspathMethod · 0.45
uri2pathMethod · 0.45
propertiesMethod · 0.45
stringMethod · 0.45
toStringMethod · 0.45
initMethod · 0.45
toStringMethod · 0.45
argMethod · 0.45
serializeMethod · 0.45
toStringMethod · 0.45

Calls 4

containsMethod · 0.95
forEachCpMethod · 0.95
addMethod · 0.95
finishMethod · 0.95

Tested by

no test coverage detected