1 abbreviate Method
Java code
- Stringutils. abbreviate ("abcdefghijklmno",-1, 10) = "abcdefg ..."
StringUtils.abbreviate("abcdefghijklmno", -1, 10) = "abcdefg..."
2. Differences between isblank and isempty Java code
- Stringutils. isblank ("") = true
- Stringutils. isempty ("") = false
StringUtils.isBlank(" ") = trueStringUtils.isEmpty(" ") = false
3 join method Java code
- Stringutils. Join (["A", "B", "C"], "--") = "A -- B -- C"
- Stringutils. Join (list ,",")
StringUtils.join(["a", "b", "c"], "--") = "a--b--c"StringUtils.join(list, ",")
4 replaceonce method replaces the target string once Java code
- Stringutils. replaceonce ("ABA", "A", "") = "ba"
StringUtils.replaceOnce("aba", "a", "") = "ba"
5 The overlay method overwrites the original string Java code.
- Stringutils. overlay ("abcdef", "ZZZZ",-1, 4) = "zzzzzzef"
StringUtils.overlay("abcdef", "zzzz", -1, 4) = "zzzzef"
6. The chomp method removes the following string Java code.
- Stringutils. Chomp ("foobar", "bar") = "foo"
- Stringutils. Chomp ("foobar", "Baz") = "foobar"
StringUtils.chomp("foobar", "bar") = "foo"StringUtils.chomp("foobar", "baz") = "foobar"
7. Remove the carriage return letter \ r \ n from the chopnewline method.
8. The padding method is used to complete the Java code.
- Stringutils. Padding (3, 'E') = "eee"
StringUtils.padding(3, 'e') = "eee"
9 center Center Method Java code
- Stringutils. Center ("A", 4) = ""
StringUtils.center("a", 4) = " a "
10 capitalize method capitalized Java code
- Stringutils. capitalize ("cat") = "cat"
StringUtils.capitalize("cat") = "Cat"
11 swapcase method case-insensitive Java code
- Stringutils. swapcase ("the dog has a bone") = "the dog has a bone"
StringUtils.swapCase("The dog has a BONE") = "tHE DOG HAS A bone"
12 The isalpha method checks whether the string contains only Unicode letters and Java code.
- Stringutils. isalpha ("ABC") = true
- Stringutils. isalpha ("ab2c") = false
- Stringutils. isalpha ("AB-c") = false
StringUtils.isAlpha("abc") = trueStringUtils.isAlpha("ab2c") = falseStringUtils.isAlpha("ab-c") = false
13. The isalphaspace method checks whether the string contains only Unicode letters and ''space Java code.
- Stringutils. isalphaspace ("ab2c") = false
- Stringutils. isalphaspace ("AB C") = true
- Stringutils. isalphaspace ("AB-c") = false
StringUtils.isAlphaSpace("ab2c") = falseStringUtils.isAlphaSpace("ab c") = trueStringUtils.isAlphaSpace("ab-c") = false
14. The isalphanumeric method checks whether a string contains only Unicode letters and numbers.
15 The isalphanumericspace method checks whether a string contains only Unicode letters, numbers, and spaces.
16 The isasciiprintable method checks whether the string contains only printable ASCII characters in Java code.
- Stringutils. isasciiprintable ("! AB-C ~ ") = True
- Stringutils. isasciiprintable ("\ u0020") = true
- Stringutils. isasciiprintable ("ceki g \ u00fclc \ u00fc") = false
StringUtils.isAsciiPrintable("!ab-c~") = trueStringUtils.isAsciiPrintable("\u0020") = trueStringUtils.isAsciiPrintable("Ceki G\u00fclc\u00fc") = false
17 The isnumeric method checks whether the string contains only numbers.
18 The iswhitespace method checks whether all strings are empty.
19 The Reverse Method reverses the string Java code
- Stringutils. Reverse ("Bat") = "tab"