/** * Sets the string to be tokenized and resets the state of the tokenizer. * * @param string The string value to be tokenized. */ public void setStringToTokenize(StringValue string) { this.toTokenize = string; this.pos = 0; this.limit = string.length(); }
/** * Sets the string to be tokenized and resets the state of the tokenizer. * * @param string The string value to be tokenized. */ public void setStringToTokenize(StringValue string) { this.toTokenize = string; this.pos = 0; this.limit = string.length(); }
/** * Converts the given <code>StringValue</code> into a lower case variant. * * @param string The string to convert to lower case. */ public static void toLowerCase(StringValue string) { final char[] chars = string.getCharArray(); final int len = string.length(); for (int i = 0; i < len; i++) { chars[i] = Character.toLowerCase(chars[i]); } }
/** * Converts the given <code>StringValue</code> into a lower case variant. * * @param string The string to convert to lower case. */ public static void toLowerCase(StringValue string) { final char[] chars = string.getCharArray(); final int len = string.length(); for (int i = 0; i < len; i++) { chars[i] = Character.toLowerCase(chars[i]); } }
public Appendable append(StringValue csq) { append(csq, 0, csq.length()); return this; }
public Appendable append(StringValue csq) { append(csq, 0, csq.length()); return this; }
/** * Replaces all non-word characters in a string by a given character. The only * characters not replaced are the characters that qualify as word characters * or digit characters with respect to {@link Character#isLetter(char)} or * {@link Character#isDigit(char)}, as well as the underscore character. * <p> * This operation is intended to simplify strings for counting distinct words. * * @param string The string value to have the non-word characters replaced. * @param replacement The character to use as the replacement. */ public static void replaceNonWordChars(StringValue string, char replacement) { final char[] chars = string.getCharArray(); final int len = string.length(); for (int i = 0; i < len; i++) { final char c = chars[i]; if (!(Character.isLetter(c) || Character.isDigit(c) || c == '_')) { chars[i] = replacement; } } }
/** * Replaces all non-word characters in a string by a given character. The only * characters not replaced are the characters that qualify as word characters * or digit characters with respect to {@link Character#isLetter(char)} or * {@link Character#isDigit(char)}, as well as the underscore character. * <p> * This operation is intended to simplify strings for counting distinct words. * * @param string The string value to have the non-word characters replaced. * @param replacement The character to use as the replacement. */ public static void replaceNonWordChars(StringValue string, char replacement) { final char[] chars = string.getCharArray(); final int len = string.length(); for (int i = 0; i < len; i++) { final char c = chars[i]; if (!(Character.isLetter(c) || Character.isDigit(c) || c == '_')) { chars[i] = replacement; } } }
CharSequence chars5 = string1.subSequence(0, 4); StringValue string5 = (StringValue) chars5; StringValue string6 = (StringValue) string0.subSequence(0, string0.length()); StringValue string7 = (StringValue) string0.subSequence(5, 9); StringValue string8 = (StringValue) string0.subSequence(0, 0); Assert.assertTrue(string0.compareTo(string7) < 0); Assert.assertEquals(stringIsA.hashCode(), string7.hashCode()); Assert.assertEquals(string7.length(), 4); Assert.assertEquals("is a", string7.getValue()); Assert.assertEquals(string8.length(), 0); Assert.assertEquals("", string8.getValue()); Assert.assertEquals('s', string7.charAt(1));