OSDN Git Service

DBFlute-0.9.3に更新
[ea2ddl/ea2ddl.git] / ea2ddl-gen / dbflute / templates / om / csharp / allcommon / util / SimpleStringUtil.vmnet
1 \r
2 using System;\r
3 \r
4 namespace ${glPackageBaseCommonUtil} {\r
5 \r
6     public class ${glSimpleStringUtil} {\r
7     \r
8         // ===================================================================================\r
9         //                                                                              String\r
10         //                                                                              ======\r
11         public static String Replace(String text, String fromText, String toText) {\r
12             if(text == null || fromText == null || toText == null) {\r
13                 return null;\r
14                 }\r
15                 return text.Replace(fromText, toText);\r
16         }\r
17         \r
18         public static String InitCap(String str) {\r
19             AssertObjectNotNull("str", str);\r
20             return str.Substring(0, 1).ToUpper() + str.Substring(1);\r
21         }\r
22 \r
23         // -----------------------------------------------------\r
24         //                                         Assert Object\r
25         //                                         -------------\r
26         protected static void AssertObjectNotNull(String variableName, Object value) {\r
27             if (variableName == null) {\r
28                 String msg = "The value should not be null: variableName=" + variableName + " value=" + value;\r
29                 throw new SystemException(msg);\r
30             }\r
31             if (value == null) {\r
32                 String msg = "The value should not be null: variableName=" + variableName;\r
33                 throw new SystemException(msg);\r
34             }\r
35         }\r
36     }\r
37 \r
38 }