List of usage examples for com.google.common.base CharMatcher WHITESPACE
CharMatcher WHITESPACE
To view the source code for com.google.common.base CharMatcher WHITESPACE.
Click Source Link
From source file:com.facebook.swift.thrift.generator.util.SwiftInternalStringUtils.java
public static boolean isBlank(final String str) { return CharMatcher.WHITESPACE.removeFrom(Strings.nullToEmpty(str)).length() == 0; }
From source file:io.sidecar.ModelUtils.java
public static boolean isValidStreamId(String stream) { return StringUtils.isNotBlank(stream) && CharMatcher.WHITESPACE.matchesNoneOf(stream); }
From source file:tk.jomp16.utils.Utils.java
public static List<String> tokenizeIRCLine(String input) { List<String> stringParts = new ArrayList<>(); if (input == null || input.length() == 0) { return stringParts; }//from w w w . ja va2s. c o m // Heavily optimized version string split by space with all characters after : // as a single entry. Under benchmarks, its faster than StringTokenizer, // String.split, toCharArray, and charAt String trimmedInput = CharMatcher.WHITESPACE.trimFrom(input); int pos = 0, end; while ((end = trimmedInput.indexOf(' ', pos)) >= 0) { stringParts.add(trimmedInput.substring(pos, end)); pos = end + 1; if (trimmedInput.charAt(pos) == ':') { stringParts.add(trimmedInput.substring(pos + 1)); return stringParts; } } // No more spaces, add last part of line stringParts.add(trimmedInput.substring(pos)); return stringParts; }
From source file:io.sidecar.ModelUtils.java
public static boolean isValidReadingKey(String key) { return StringUtils.isNotBlank(key) && key.length() <= 40 && CharMatcher.WHITESPACE.matchesNoneOf(key); }
From source file:com.google.gerrit.server.change.HashtagsUtil.java
public static String cleanupHashtag(String hashtag) { hashtag = LEADER.trimLeadingFrom(hashtag); hashtag = CharMatcher.whitespace().trimTrailingFrom(hashtag); return hashtag; }
From source file:monasca.log.api.app.validation.LogApplicationTypeValidator.java
/** * Normalizes the {@code applicationType} by removing whitespace. */// ww w .java 2 s .c o m public static String normalize(String applicationType) { return applicationType == null ? null : CharMatcher.WHITESPACE.trimFrom(applicationType); }
From source file:monasca.api.app.validation.MetricNameValidation.java
/** * Normalizes the {@code metricName} by removing whitespace. *//*w w w.j a v a 2 s .co m*/ public static String normalize(String metricName) { return metricName == null ? null : CharMatcher.WHITESPACE.trimFrom(metricName); }
From source file:com.dragovorn.dragonbot.Utils.java
public static List<String> tokenizeLine(String input) { List<String> parts = new ArrayList<>(); if (input == null || input.length() == 0) { return parts; }//from w w w. j a v a2 s.c o m String trimmedInput = CharMatcher.WHITESPACE.trimFrom(input); int pos = 0; int end; while ((end = trimmedInput.indexOf(' ', pos)) >= 0) { parts.add(trimmedInput.substring(pos, end)); pos = end + 1; if (trimmedInput.charAt(pos) == ':') { parts.add(trimmedInput.substring(pos + 1)); return parts; } } parts.add(trimmedInput.substring(pos)); return parts; }
From source file:jetbrains.jetpad.hybrid.HybridWrapperRoleCompletion.java
private static boolean isNotBlank(String string) { return CharMatcher.whitespace().negate().matchesAnyOf(string); }
From source file:com.mikehoffert.easyappend.view.TextWrapper.java
/** * Creates a wrapper for the desired width. * @param i The maximum width of the lines. * @return The text wrapper.//from w w w. j a v a2s .c o m */ public static TextWrapper forWidth(int i) { return new TextWrapper(CharMatcher.WHITESPACE, i, 0); }