Tabnine Logo
String.codePointBefore
Code IndexAdd Tabnine to your IDE (free)

How to use
codePointBefore
method
in
java.lang.String

Best Java code snippets using java.lang.String.codePointBefore (Showing top 20 results out of 315)

origin: wildfly/wildfly

int peekPrev() {
  return str.codePointBefore(idx);
}
origin: vavr-io/vavr

/**
 * 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);
}
origin: neo4j/neo4j

  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;
  }
}
origin: wildfly/wildfly

int prev() {
  final int idx = this.idx;
  try {
    return str.codePointBefore(idx);
  } finally {
    this.idx = str.offsetByCodePoints(idx, -1);
  }
}
origin: wildfly/wildfly

public int peekPrev() throws NoSuchElementException {
  if (! hasPrev()) throw new NoSuchElementException();
  return string.codePointBefore(idx + offs);
}
origin: wildfly/wildfly

public int peekPrevious() throws NoSuchElementException {
  if (! hasPrevious()) throw new NoSuchElementException();
  return string.codePointBefore(idx + offs);
}
origin: wildfly/wildfly

@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);
  }
}
origin: oracle/opengrok

int cp = filename.codePointBefore(newLength);
int nChars = Character.charCount(cp);
String c = filename.substring(newLength - nChars, newLength);
origin: com.liferay.portal/com.liferay.portal.kernel

offset = s.offsetByCodePoints(0, j);
if (Character.isWhitespace(s.codePointBefore(offset))) {
  curLength = j - 1;
origin: opengeospatial/geoapi

/**
 * 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;
}
origin: org.wildfly.common/wildfly-common

int prev() {
  final int idx = this.idx;
  try {
    return str.codePointBefore(idx);
  } finally {
    this.idx = str.offsetByCodePoints(idx, -1);
  }
}
origin: org.jboss.eap/wildfly-client-all

int prev() {
  final int idx = this.idx;
  try {
    return str.codePointBefore(idx);
  } finally {
    this.idx = str.offsetByCodePoints(idx, -1);
  }
}
origin: org.jboss.eap/wildfly-client-all

public int peekPrev() throws NoSuchElementException {
  if (! hasPrev()) throw new NoSuchElementException();
  return string.codePointBefore(idx + offs);
}
origin: org.wildfly.common/wildfly-common

public int peekPrevious() throws NoSuchElementException {
  if (! hasPrevious()) throw new NoSuchElementException();
  return string.codePointBefore(idx + offs);
}
origin: org.wildfly.security/wildfly-elytron

public int peekPrev() throws NoSuchElementException {
  if (! hasPrev()) throw new NoSuchElementException();
  return string.codePointBefore(idx + offs);
}
origin: NationalSecurityAgency/datawave

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);
}

origin: NationalSecurityAgency/datawave

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);
}

origin: org.ceylon-lang/ceylon.language

@Ignore
public static Character getLast(java.lang.String value) {
  if (value.isEmpty()) {
    return null;
  } else {
    return Character.instance(value.codePointBefore(value.length()));
  }
}
origin: smola/galimatias

private void decrIdx() {
  if (idx <= startIdx) {
    setIdx(idx - 1);
    return;
  }
  final int charCount = Character.charCount(this.input.codePointBefore(idx));
  setIdx(this.idx - charCount);
}
origin: org.ceylon-lang/ceylon.language

@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;
}

java.langStringcodePointBefore

Javadoc

Returns the character (Unicode code point) before the specified index. The index refers to char values (Unicode code units) and ranges from 1 to CharSequence#length().

If the char value at (index - 1) is in the low-surrogate range, (index - 2) is not negative, and the char value at (index - 2) is in the high-surrogate range, then the supplementary code point value of the surrogate pair is returned. If the char value at index - 1 is an unpaired low-surrogate or a high-surrogate, the surrogate value is returned.

Popular methods of String

  • equals
  • length
    Returns the number of characters in this string.
  • substring
    Returns a string containing a subsequence of characters from this string. The returned string shares
  • startsWith
    Compares the specified string to this string, starting at the specified offset, to determine if the
  • format
    Returns a formatted string, using the supplied format and arguments, localized to the given locale.
  • split
    Splits this string using the supplied regularExpression. See Pattern#split(CharSequence,int) for an
  • trim
  • valueOf
    Creates a new string containing the specified characters in the character array. Modifying the chara
  • indexOf
  • endsWith
    Compares the specified string to this string to determine if the specified string is a suffix.
  • toLowerCase
    Converts this string to lower case, using the rules of locale.Most case mappings are unaffected by t
  • contains
    Determines if this String contains the sequence of characters in the CharSequence passed.
  • toLowerCase,
  • contains,
  • getBytes,
  • <init>,
  • equalsIgnoreCase,
  • replace,
  • isEmpty,
  • charAt,
  • hashCode,
  • lastIndexOf

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now