The operation object of the stringutils method is Java. lang. string-type objects are complementary to the string-type operation method provided by JDK, and are null safe (that is, if the input parameter string is null, nullpointerexception is not thrown, but corresponding processing is performed, for example, if the input is null, the return value is also null. You can view the source code ). In addition to the constringutils, there are more than 130 methods in stringutils, all of which are static, so we can call stringutils in this way. the following describes some common methods: 1. public static Boolean isempty (string Str) determines whether a string is null. The standard for null is str = NULL or str. length () = 0 The following is an example of stringutils to determine whether it is null: stringutils. isempty (null) = truestringutils. isempty ("") = true stringutils. isempty ("") = false // note that the space in stringutils is not empty to process stringutils. isempty ("") = falsestringutils. isempty ("Bob") = falsestringu Tils. isempty ("Bob") = false2. public static Boolean isnotempty (string Str) judge whether a string is not empty, equal! The following is an example of isempty (string Str): stringutils. isnotempty (null) = false stringutils. isnotempty ("") = false stringutils. isnotempty ("") = true stringutils. isnotempty ("") = true stringutils. isnotempty ("Bob") = true stringutils. isnotempty ("Bob") = true3. public static Boolean isblank (string Str) determines whether a string is null or has a length of 0 or is composed of whitespace. The following is an example: stringutils. isblank (null) = true stringutils. isblank ("") = true strin Gutils. isblank ("") = true stringutils. isblank ("") = true stringutils. isblank ("\ t \ n \ f \ r") = true // For tabs, line breaks, page breaks, and carriage returns stringutils. isblank () // both recognize as the blank space character stringutils. isblank ("\ B") = false // "\ B" is the word boundary character stringutils. isblank ("Bob") = false stringutils. isblank ("Bob") = false4. public static Boolean isnotblank (string Str) judge whether a string is not empty and its length is not 0 and cannot be composed of whitespace. equal! The following is an example of isblank (string Str): stringutils. isnotblank (null) = false stringutils. isnotblank ("") = false stringutils. isnotblank ("") = false stringutils. isnotblank ("") = false stringutils. isnotblank ("\ t \ n \ f \ r") = false stringutils. isnotblank ("\ B") = true stringutils. isnotblank ("Bob") = true stringutils. isnotblank ("Bob") = true5. public static string trim (string Str) Remove the control character (control characters, Char <= 32). If the input is null, null is returned. The following is an example: stringutils. trim (null) = NULL stringutils. trim ("") = "" stringutils. trim ("") = "" stringutils. trim ("\ B \ t \ n \ f \ r") = "" stringutils. trim ("\ n \ TSS \ B") = "SS" stringutils. trim ("d dd") = "d dd" stringutils. trim ("DD") = "DD" stringutils. trim ("DD") = "DD" 6. public static string trimtonull (string Str) removes the control character (control characters, char <= 32) at both ends of the string. If it is null or "", return NULL. The following is an example: stringutils. trimtonull (null) = NULL stringutils. trimtonull ("") = NULL stringutils. trimtonull ("") = NULL stringutils. trimtonull ("\ B \ t \ n \ f \ r") = NULL stringutils. trimtonull ("\ n \ TSS \ B") = "SS" stringutils. trimtonull ("d dd") = "d dd" stringutils. trimtonull ("DD") = "DD" stringutils. trimtonull ("DD") = "DD" 7. public static string trimtoempty (string Str) Remove two strings Control Character (char <= 32). If it is null or "", return "". The following is an example: stringutils. trimtoempty (null) = "" stringutils. trimtoempty ("") = "" stringutils. trimtoempty ("") = "" stringutils. trimtoempty ("\ B \ t \ n \ f \ r") = "" stringutils. trimtoempty ("\ n \ TSS \ B") = "SS" stringutils. trimtoempty ("d dd") = "d dd" stringutils. trimtoempty ("DD") = "DD" stringutils. trimtoempty ("DD") = "DD" 8. public St Atic string strip (string Str) removes the whitespace at both ends of the string. If the input is null, null is returned. The following is an example (note and trim (): stringutils. strip (null) = NULL stringutils. strip ("") = "" stringutils. strip ("") = "" stringutils. strip ("\ B \ t \ n \ f \ r") = "\ B" stringutils. strip ("\ n \ TSS \ B") = "SS \ B" stringutils. strip ("d dd") = "d dd" stringutils. strip ("DD") = "DD" stringutils. strip ("DD") = "DD" 9. public static string Striptonull (string Str) removes the whitespace at both ends of the string. If it becomes null or "", null is returned. The following is an example (note the difference with trimtonull (): stringutils. striptonull (null) = NULL stringutils. striptonull ("") = NULL stringutils. striptonull ("") = NULL stringutils. striptonull ("\ B \ t \ n \ f \ r") = "\ B" stringutils. striptonull ("\ n \ TSS \ B") = "SS \ B" stringutils. striptonull ("d dd") = "d dd" stringutils. striptonull ("DD") = "DD" stringu Tils. striptonull ("DD") = "DD" 10. public static string striptoempty (string Str) removes the whitespace at both ends of the string. If it is null or "", the return value is "". The following is an example (note the difference between it and trimtoempty): stringutils. striptonull (null) = "" stringutils. striptonull ("") = "" stringutils. striptonull ("") = "" stringutils. striptonull ("\ B \ t \ n \ f \ r") = "\ B" stringutils. striptonull ("\ n \ TSS \ B") = "SS \ B" stringutils. striptonull ("d dd") = "d Dd "stringutils. striptonull ("DD") = "DD" stringutils. striptonull ("DD") = "DD" the following method only describes its functions. public static string strip (string STR, string stripchars) removes the characters at both ends of STR in stripchars. If STR is null or equal to "", it is returned. If stripchars is null or "", strip (string Str) is returned ). 12. Public static string stripstart (string STR, string stripchars) is similar to 11. Remove the character of STR in stripchars. 13. Public static string stripend (string STR, string stripchars) is similar to 11. Remove the character at the end of STR in stripchars. 14. Public static string [] stripall (string [] STRs) strip (string Str) each string in the string array, and then return. If STRs is null or STRs is 0, return STRs 15. public static string [] stripall (string [] STRs, string stripchars) strip (string STR, string stripchars) each string in the string array, and then return. If STRs is null or STRs is 0, return STRs itself 16. public static Boolean equals (string str1, string str2) compares two strings for equality. If both strings are null, they are considered equal. 17. Public static Boolean inclusignorecase (string str1, string str2) compares the two strings to determine whether they are equal, Case Insensitive. If both are empty, they are considered equal. 18. Public static int indexof (string STR, char searchchar) returns the position of the character searchchar in string STR for the first time. If searchchar does not appear in STR,-1 is returned. If STR is null or "",-119 is returned. public static int indexof (string STR, char searchchar, int startpos) returns the position where the character searchchar first appears in string STR from startpos. If searchchar does not appear in STR from startpos,-1 is returned. If STR is null or "",-120 is returned. public static int indexof (string STR, string searchstr) returns the position where the string searchstr first appears in the string Str. If STR is null or searchstr is null,-1 is returned. If searchstr is "" And STR is not null, 0 is returned. If searchstr is not in STR, -121 is returned. public static int ordinalindexof (string STR, string searchstr, int ordinal) returns the position of the string searchstr in the string str at ordinal. If STR = NULL or searchstr = NULL or ordinal <= 0, return the-1 example (* representing any string): stringutils. ordinalindexof (null, *, *) =-1 stringutils. ordinalindexof (*, null, *) =-1 stringutils. ordinalindexof ("", "", *) = 0 stringutils. ordinalindexof ("aabaabaa", "A", 1) = 0 stringutils. ordinalindexof ("aabaabaa", "A", 2) = 1 stringutils. ordinalindexof ("aabaabaa", "B", 1) = 2 stringutils. ordinalindexof ("aabaabaa", "B", 2) = 5 stri Ngutils. ordinalindexof ("aabaabaa", "AB", 1) = 1 stringutils. ordinalindexof ("aabaabaa", "AB", 2) = 4 stringutils. ordinalindexof ("aabaabaa", "BC", 1) =-1 stringutils. ordinalindexof ("aabaabaa", "", 1) = 0 stringutils. ordinalindexof ("aabaabaa", "", 2) = 022. public static int indexof (string STR, string searchstr, int startpos) returns the position where string searchstr first appears in string STR from startpos. Example (* represents any string): stringutils. indexof (null, *, *) =-1 stringutils. indexof (*, null, *) =-1 stringutils. indexof ("", "", 0) = 0 stringutils. indexof ("aabaabaa", "A", 0) = 0 stringutils. indexof ("aabaabaa", "B", 0) = 2 stringutils. indexof ("aabaabaa", "AB", 0) = 1 stringutils. indexof ("aabaabaa", "B", 3) = 5 stringutils. indexof ("aabaabaa", "B", 9) =-1 stringutils. indexof ("aabaabaa", "B",-1) = 2 stringutils. indexof ("aabaabaa", "", 2) = 2 stringutils. indexof ("ABC", "", 9) = 323. the basic principle of public static int lastindexof (string STR, char searchchar) is 1824. public static int lastindexof (string STR, char searchchar, int startpos) The basic principle is the same as 1925. the basic principle of public static int lastindexof (string STR, string searchstr) is the same as 2026. public static int lastindexof (string STR, string searchstr, int startpos)