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)
| 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) { |
no test coverage detected