1 ${database.allClassCopyright}package ${glPackageBaseCommonUtil};
\r
4 * @author ${database.ClassAuthor}
\r
6 public class ${glSimpleStringUtil} {
\r
8 // ===================================================================================
\r
11 public static String replace(String text, String fromText, String toText) {
\r
12 if(text == null || fromText == null || toText == null) {
\r
15 StringBuilder sb = new StringBuilder();
\r
19 pos = text.indexOf(fromText, pos2);
\r
22 pos2 = fromText.length();
\r
25 sb.append(text.substring(pos2, pos));
\r
27 pos2 = pos + fromText.length();
\r
29 sb.append(text.substring(pos2));
\r
30 return sb.toString();
\r
35 public static String initCap(String str) {
\r
36 assertObjectNotNull("str", str);
\r
37 return str.substring(0, 1).toUpperCase() + str.substring(1);
\r
40 public static String initUncap(String str) {
\r
41 assertObjectNotNull("str", str);
\r
42 return str.substring(0, 1).toLowerCase() + str.substring(1);
\r
45 // -----------------------------------------------------
\r
49 * Assert that the object is not null.
\r
50 * @param variableName Variable name. (NotNull)
\r
51 * @param value Value. (NotNull)
\r
52 * @exception IllegalArgumentException
\r
54 protected static void assertObjectNotNull(String variableName, Object value) {
\r
55 if (variableName == null) {
\r
56 String msg = "The value should not be null: variableName=" + variableName + " value=" + value;
\r
57 throw new IllegalArgumentException(msg);
\r
59 if (value == null) {
\r
60 String msg = "The value should not be null: variableName=" + variableName;
\r
61 throw new IllegalArgumentException(msg);
\r