OSDN Git Service

Txxxxx
[traindelaybot/source.git] / workspace / .metadata / .plugins / org.eclipse.core.resources / .history / 0 / 80d0300c106b001115b7b82f2f4ce01a
diff --git a/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/0/80d0300c106b001115b7b82f2f4ce01a b/workspace/.metadata/.plugins/org.eclipse.core.resources/.history/0/80d0300c106b001115b7b82f2f4ce01a
deleted file mode 100644 (file)
index d7af4cb..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.yuji.tdb.utility;
-
-import java.util.regex.Pattern;
-
-public class StringUtility {
-       private static Pattern ptnAlnum = Pattern.compile("[a-zA-Z0-9]");
-       private static Pattern ptnSpace = Pattern.compile("\\s");
-       private static Pattern ptnAscii = Pattern.compile("\\p{ASCII}");
-       
-       public static String parseSubstring(String text, int length){
-               int len = text.length();
-               int status = -1;
-               int pos = 0;
-               
-               for (int i = 0; i < len + 1 && i < length + 1; i++){
-                       if (i >= len){
-                               pos = i;
-                               break;
-                       }
-                       String ch = text.substring(i, i + 1);
-                       
-                       if (ptnAlnum.matcher(ch).matches()){
-                               if (status != 0){
-                                       if (status != 1){
-                                               pos = i;
-                                       }
-                                       status = 0;
-                               }
-                       }
-                       else if (ptnSpace.matcher(ch).matches()){
-                               if (status != 1){
-                                       pos = i;
-                                       status = 1;
-                               }
-                       }
-                       else if (ptnAscii.matcher(ch).matches()){
-                               if (status != 2){
-                                       if (status != 1){
-                                               pos = i;
-                                       }
-                                       status = 2;
-                               }                               
-                       }
-                       else {
-                               pos = i;
-                               status = 3;
-                       }
-               }
-               if (pos == 0){
-                       return text.substring(0, (len < length)? len : length);                 
-               }
-               return text.substring(0, pos);
-       }
-}