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

Method lastIndexOf

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

Returns the last position of the specified character. @param token token @param ch character to be found @return position, or -1 if token is not found.

(final byte[] token, final int ch)

Source from the content-addressed store, hash-verified

865 * @return position, or {@code -1} if token is not found.
866 */
867 public static int lastIndexOf(final byte[] token, final int ch) {
868 final int tl = token.length;
869 int p = -1;
870 if(ch <= 0x7F) {
871 for(int t = tl - 1; t >= 0; --t) {
872 if(token[t] == ch) return t;
873 }
874 } else {
875 for(int t = 0; t < tl; t += cl(token, t)) {
876 if(cp(token, t) == ch) p = t;
877 }
878 }
879 return p;
880 }
881
882 /**
883 * Returns the position of the specified token.

Callers 15

parseMethod · 0.80
backupsMethod · 0.80
buildMethod · 0.80
asciiAuthorityMethod · 0.80
dbNameMethod · 0.80
dirMethod · 0.80
checkSuffixMethod · 0.80
fillXmlInputMethod · 0.80
nameMethod · 0.80
versionMethod · 0.80
nameMethod · 0.80
IntFormatMethod · 0.80

Calls 2

clMethod · 0.95
cpMethod · 0.95

Tested by

no test coverage detected