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

Method substring

basex-core/src/main/java/org/basex/query/value/item/AStr.java:108–117  ·  view source on GitHub ↗

Returns a substring. @param info input info (can be null) @param start start position @param end end position @return substring @throws QueryException query exception

(final InputInfo info, final int start, final int end)

Source from the content-addressed store, hash-verified

106 * @throws QueryException query exception
107 */
108 public final AStr substring(final InputInfo info, final int start, final int end)
109 throws QueryException {
110 if(start == 0 && end == length(info)) return this;
111
112 final byte[] token = string(info);
113 final boolean ascii = ascii(info);
114 final int s = ascii ? start : offsets[start];
115 final int e = ascii ? end : end < offsets.length ? offsets[end] : token.length;
116 return Str.get(Arrays.copyOfRange(token, s, e));
117 }
118
119 @Override
120 public final boolean comparable(final Item item) {

Callers 15

itemMethod · 0.95
QueryInputMethod · 0.45
castMethod · 0.45
qnameMethod · 0.45
tokensMethod · 0.45
completeMethod · 0.45
QueryDateTimeMethod · 0.45
entityErrorMethod · 0.45
AnnotationMethod · 0.45
itemMethod · 0.45
FuncDefinitionMethod · 0.45
argsMethod · 0.45

Calls 4

lengthMethod · 0.95
asciiMethod · 0.95
getMethod · 0.95
stringMethod · 0.45

Tested by

no test coverage detected