@PublicEvolving public final class StringValueUtils extends Object
StringValue
.
All methods in this class are written to be optimized for efficiency and work directly on the StringValues char arrays, avoiding copies. For simplicity and efficiency, the methods only apply to strings whose characters are representable in a single char, ie. strings without surrogate characters.
Modifier and Type | Class and Description |
---|---|
static class |
StringValueUtils.WhitespaceTokenizer
A tokenizer for string values that uses whitespace characters as token delimiters.
|
Modifier and Type | Method and Description |
---|---|
static void |
replaceNonWordChars(StringValue string,
char replacement)
Replaces all non-word characters in a string by a given character.
|
static void |
toLowerCase(StringValue string)
Converts the given
StringValue into a lower case variant. |
public static void toLowerCase(StringValue string)
StringValue
into a lower case variant.string
- The string to convert to lower case.public static void replaceNonWordChars(StringValue string, char replacement)
Character.isLetter(char)
or
Character.isDigit(char)
, as well as the underscore character.
This operation is intended to simplify strings for counting distinct words.
string
- The string value to have the non-word characters replaced.replacement
- The character to use as the replacement.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.