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

How to use
codePoints
method
in
java.lang.String

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

origin: jenkinsci/configuration-as-code-plugin

@Override
public IntStream codePoints() {
  return value.codePoints();
}
origin: SonarSource/sonarqube

 @CheckForNull
 private static String removeCharZeros(@Nullable String str) {
  if (str == null || str.isEmpty()) {
   return str;
  }
  return str.codePoints()
   .filter(c -> c != "\u0000".codePointAt(0))
   .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
   .toString();
 }
}
origin: Vedenin/useful-java-links

@Benchmark
public long java8_1() {
  // Using Java8 (case 2)
  return testString.codePoints().filter(ch -> ch == '.').count();
}
origin: Vedenin/useful-java-links

@Benchmark
public long java8_1() {
  // Using Java8 (case 2)
  return testString.codePoints().filter(ch -> ch == '.').count();
}
origin: prestodb/presto

public static Slice unescapeLiteralLikePattern(Slice pattern, Slice escape)
{
  if (escape == null) {
    return pattern;
  }
  String stringEscape = escape.toStringUtf8();
  char escapeChar = stringEscape.charAt(0);
  String stringPattern = pattern.toStringUtf8();
  StringBuilder unescapedPattern = new StringBuilder(stringPattern.length());
  boolean escaped = false;
  for (int currentChar : stringPattern.codePoints().toArray()) {
    if (!escaped && (currentChar == escapeChar)) {
      escaped = true;
    }
    else {
      unescapedPattern.append(Character.toChars(currentChar));
      escaped = false;
    }
  }
  return Slices.utf8Slice(unescapedPattern.toString());
}
origin: prestodb/presto

PrimitiveIterator.OfInt iterator = s.codePoints().iterator();
while (iterator.hasNext()) {
  int codePoint = iterator.nextInt();
origin: prestodb/presto

private static String lowerByCodePoint(String string)
{
  int[] upperCodePoints = string.codePoints().map(Character::toLowerCase).toArray();
  return new String(upperCodePoints, 0, upperCodePoints.length);
}
origin: prestodb/presto

private static String upperByCodePoint(String string)
{
  int[] upperCodePoints = string.codePoints().map(Character::toUpperCase).toArray();
  return new String(upperCodePoints, 0, upperCodePoints.length);
}
origin: prestodb/presto

public static boolean isLikePattern(Slice pattern, Slice escape)
{
  String stringPattern = pattern.toStringUtf8();
  if (escape == null) {
    return stringPattern.contains("%") || stringPattern.contains("_");
  }
  String stringEscape = escape.toStringUtf8();
  checkCondition(stringEscape.length() == 1, INVALID_FUNCTION_ARGUMENT, "Escape string must be a single character");
  char escapeChar = stringEscape.charAt(0);
  boolean escaped = false;
  boolean isLikePattern = false;
  for (int currentChar : stringPattern.codePoints().toArray()) {
    if (!escaped && (currentChar == escapeChar)) {
      escaped = true;
    }
    else if (escaped) {
      checkEscape(currentChar == '%' || currentChar == '_' || currentChar == escapeChar);
      escaped = false;
    }
    else if ((currentChar == '%') || (currentChar == '_')) {
      isLikePattern = true;
    }
  }
  checkEscape(!escaped);
  return isLikePattern;
}
origin: pholser/junit-quickcheck

private boolean codePointsInRange(String s) {
  return s.codePoints().allMatch(this::codePointInRange);
}
origin: pholser/junit-quickcheck

@Override public List<String> doShrink(SourceOfRandomness random, String larger) {
  List<String> shrinks = new ArrayList<>();
  List<Integer> codePoints = larger.codePoints().boxed().collect(toList());
  shrinks.addAll(removals(codePoints));
  List<List<Integer>> oneItemShrinks =
    shrinksOfOneItem(random, codePoints, new CodePointShrink(this::codePointInRange));
  shrinks.addAll(oneItemShrinks.stream()
    .map(this::convert)
    .filter(this::codePointsInRange)
    .collect(toList()));
  return shrinks;
}
origin: zstackio/zstack

  public static boolean checkCharacter(String s){
    return s.codePoints().allMatch(code -> CharUtils.isAsciiPrintable((char) code));
  }
}
origin: diffplug/spotless

/** Returns true iff the given file's formatting is up-to-date. */
public boolean isClean(File file) throws IOException {
  Objects.requireNonNull(file);
  String raw = new String(Files.readAllBytes(file.toPath()), encoding);
  String unix = LineEnding.toUnix(raw);
  // check the newlines (we can find these problems without even running the steps)
  int totalNewLines = (int) unix.codePoints().filter(val -> val == '\n').count();
  int windowsNewLines = raw.length() - unix.length();
  if (lineEndingsPolicy.isUnix(file)) {
    if (windowsNewLines != 0) {
      return false;
    }
  } else {
    if (windowsNewLines != totalNewLines) {
      return false;
    }
  }
  // check the other formats
  String formatted = compute(unix, file);
  // return true iff the formatted string equals the unix one
  return formatted.equals(unix);
}
origin: pholser/junit-quickcheck

  @Property public void works(
    Optional<@From(Encoded.class) @InCharset("US-ASCII") String> optional) {
    assumeTrue(optional.isPresent());
    assertTrue(optional.get().codePoints().allMatch(i -> i < 128));
  }
}
origin: pholser/junit-quickcheck

  @Property public void works(
    Optional<@From(Encoded.class) @InCharset("US-ASCII") String> optional) {
    assumeTrue(optional.isPresent());
    assertTrue(optional.get().codePoints().allMatch(i -> i < 128));
  }
}
origin: airlift/slice

private static String upperByCodePoint(String string)
{
  int[] upperCodePoints = string.codePoints().map(Character::toUpperCase).toArray();
  return new String(upperCodePoints, 0, upperCodePoints.length);
}
origin: io.airlift/slice

private static String lowerByCodePoint(String string)
{
  int[] upperCodePoints = string.codePoints().map(Character::toLowerCase).toArray();
  return new String(upperCodePoints, 0, upperCodePoints.length);
}
origin: uk.co.nichesolutions.presto/presto-main

private static String lowerByCodePoint(String string)
{
  int[] upperCodePoints = string.codePoints().map(Character::toLowerCase).toArray();
  return new String(upperCodePoints, 0, upperCodePoints.length);
}
origin: airlift/slice

private static void assertReverse(String string)
{
  Slice actualReverse = reverse(utf8Slice(string));
  int[] codePoints = string.codePoints().toArray();
  codePoints = Ints.toArray(Lists.reverse(Ints.asList(codePoints)));
  Slice expectedReverse = wrappedBuffer(new String(codePoints, 0, codePoints.length).getBytes(UTF_8));
  assertEquals(actualReverse, expectedReverse);
}
origin: io.airlift/slice

private static void assertReverse(String string)
{
  Slice actualReverse = reverse(utf8Slice(string));
  int[] codePoints = string.codePoints().toArray();
  codePoints = Ints.toArray(Lists.reverse(Ints.asList(codePoints)));
  Slice expectedReverse = wrappedBuffer(new String(codePoints, 0, codePoints.length).getBytes(UTF_8));
  assertEquals(actualReverse, expectedReverse);
}
java.langStringcodePoints

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
  • CodeWhisperer 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