OSDN Git Service

20170125
[rapideact/rapideact.git] / com / rapide_act / CmnUtils.java
index 68f8d75..70ba137 100644 (file)
@@ -423,6 +423,14 @@ public class CmnUtils{
                }
        }
 
+       public static boolean isEmpty(String _str) throws Exception{
+               if(_str == null || _str.equals("")){
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
        public static String[] getSystemProperty(String _str) throws Exception{
                String [] retValue = null;
                if(System.getProperty(_str)!=null){
@@ -499,6 +507,43 @@ public class CmnUtils{
                return retValue;
        }
 
+       public static String getDelimiter(String _str) throws Exception{
+               String retValue = _str;
+               if(_str!=null){
+                       char [] chr = new char[_str.length()];
+                       int j = 0;
+                       for(int i=0;i<_str.length();i++){
+                               if (i < _str.length() - 1){
+                                       if (_str.charAt(i) == '\\'){
+                                               switch(_str.charAt(i + 1)){
+                                                       case 't':
+                                                               chr[j] = 0x09;
+                                                               i++;
+                                                               j++;
+                                                               break;
+                                                       default:
+                                                               chr[j] = _str.charAt(i);
+                                                               j++;
+                                                               break;
+                                               }
+                                       } else {
+                                               chr[j] = _str.charAt(i);
+                                               j++;
+                                       }
+                               } else {
+                                       chr[j] = _str.charAt(i);
+                                       j++;
+                               }
+                       }
+                       char [] chr2 = new char[j];
+                       for(int i=0;i<j;i++){
+                               chr2[i] = chr[i];
+                       }
+                       retValue = String.valueOf(chr2);
+               }
+               return retValue;
+       }
+
        public static String getLineSeparator(String _str, String _strDefault) throws Exception{
                String retValue = _strDefault;
                if(System.getProperty(_str)!=null){
@@ -532,5 +577,36 @@ public class CmnUtils{
                return retValue;
        }
 
+       public static String getLineSeparator(String _str) throws Exception{
+               String retValue = _str;
+               if(_str!=null){
+                       char [] chr = new char[_str.length()];
+                       int j = 0;
+                       for(int i=0;i<_str.length();i++){
+                               if (i < _str.length() - 1){
+                                       if (_str.charAt(i) == '\\'){
+                                               switch(_str.charAt(i + 1)){
+                                                       case 'r':
+                                                               chr[j] = 0x0d;
+                                                               i++;
+                                                               j++;
+                                                               break;
+                                                       case 'n':
+                                                               chr[j] = 0x0a;
+                                                               i++;
+                                                               j++;
+                                                               break;
+                                               }
+                                       }
+                               }
+                       }
+                       char [] chr2 = new char[j];
+                       for(int i=0;i<j;i++){
+                               chr2[i] = chr[i];
+                       }
+                       retValue = String.valueOf(chr2);
+               }
+               return retValue;
+       }
 
 }