int peekPrev() { return str.codePointBefore(idx); }
/** * Returns the character (Unicode code point) before the specified * index. The index refers to {@code char} values * (Unicode code units) and ranges from {@code 1} to {@link * CharSequence#length() length}. * <p> * If the {@code char} value at {@code (index - 1)} * is in the low-surrogate range, {@code (index - 2)} is not * negative, and the {@code char} value at {@code (index - * 2)} is in the high-surrogate range, then the * supplementary code point value of the surrogate pair is * returned. If the {@code char} value at {@code index - * 1} is an unpaired low-surrogate or a high-surrogate, the * surrogate value is returned. * * @param index the index following the code point that should be returned * @return the Unicode code point value before the given index. * @throws IndexOutOfBoundsException if the {@code index} * argument is less than 1 or greater than the length * of this string. */ public int codePointBefore(int index) { return back.codePointBefore(index); }
private int rtrimIndex( String value ) { int end = value.length(); while ( end > 0 ) { int codePoint = value.codePointBefore( end ); if ( !Character.isWhitespace( codePoint ) ) { break; } end--; } return end; } }
int prev() { final int idx = this.idx; try { return str.codePointBefore(idx); } finally { this.idx = str.offsetByCodePoints(idx, -1); } }
public int peekPrev() throws NoSuchElementException { if (! hasPrev()) throw new NoSuchElementException(); return string.codePointBefore(idx + offs); }
public int peekPrevious() throws NoSuchElementException { if (! hasPrevious()) throw new NoSuchElementException(); return string.codePointBefore(idx + offs); }
@Override public boolean matches(final URI uri, final String abstractType, final String abstractTypeAuthority) { String host = uri.getHost(); if (host == null) { return false; } final String canonHost = host.toLowerCase(Locale.ROOT); if (suffixMatch) { if (canonHost.equals(hostSpec)) { return super.matches(uri, abstractType, abstractTypeAuthority); } if (canonHost.endsWith(hostSpec)) { assert canonHost.length() > hostSpec.length(); // because otherwise it would be equal, which is tested above return canonHost.codePointBefore(canonHost.length() - hostSpec.length()) == '.' && super.matches(uri, abstractType, abstractTypeAuthority); } return false; } else { return canonHost.equals(hostSpec) && super.matches(uri, abstractType, abstractTypeAuthority); } }
int cp = filename.codePointBefore(newLength); int nChars = Character.charCount(cp); String c = filename.substring(newLength - nChars, newLength);
offset = s.offsetByCodePoints(0, j); if (Character.isWhitespace(s.codePointBefore(offset))) { curLength = j - 1;
/** * Returns the index {@literal <} {@code from} of the last whitespace character. */ private static int skipTrailingWhitespaces(final String doc, int from) { while (from > 0) { final int c = doc.codePointBefore(from); if (!Character.isWhitespace(c)) break; from -= Character.charCount(c); } return from; }
int prev() { final int idx = this.idx; try { return str.codePointBefore(idx); } finally { this.idx = str.offsetByCodePoints(idx, -1); } }
int prev() { final int idx = this.idx; try { return str.codePointBefore(idx); } finally { this.idx = str.offsetByCodePoints(idx, -1); } }
public int peekPrev() throws NoSuchElementException { if (! hasPrev()) throw new NoSuchElementException(); return string.codePointBefore(idx + offs); }
public int peekPrevious() throws NoSuchElementException { if (! hasPrevious()) throw new NoSuchElementException(); return string.codePointBefore(idx + offs); }
public int peekPrev() throws NoSuchElementException { if (! hasPrev()) throw new NoSuchElementException(); return string.codePointBefore(idx + offs); }
public static String incrementOneCodepoint(String term) { int codepoint = term.codePointBefore(term.length()); int cpc = term.codePointCount(0, term.length()); int offset = term.offsetByCodePoints(0, cpc - 1); codepoint = codepoint < Integer.MAX_VALUE ? codepoint + 1 : codepoint; int cparray[] = {codepoint}; return term.substring(0, offset) + new String(cparray, 0, 1); }
public static String decrementOneCodepoint(String term) { int codepoint = term.codePointBefore(term.length()); int cpc = term.codePointCount(0, term.length()); int offset = term.offsetByCodePoints(0, cpc - 1); codepoint = codepoint > 0 ? codepoint - 1 : codepoint; int cparray[] = {codepoint}; return term.substring(0, offset) + new String(cparray, 0, 1); }
@Ignore public static Character getLast(java.lang.String value) { if (value.isEmpty()) { return null; } else { return Character.instance(value.codePointBefore(value.length())); } }
private void decrIdx() { if (idx <= startIdx) { setIdx(idx - 1); return; } final int charCount = Character.charCount(this.input.codePointBefore(idx)); setIdx(this.idx - charCount); }
@Ignore public static Integer lastIndexWhere(java.lang.String value, Callable<? extends Boolean> fun) { for (int offset = value.length(); offset>0;) { int cp = value.codePointBefore(offset); offset-=java.lang.Character.charCount(cp); if (fun.$call$(Character.instance(cp)).booleanValue()) { int index = value.codePointCount(0, offset); return Integer.instance(index); } } return null; }