JAL-1645 source formatting and organise imports
[jalview.git] / src / jalview / util / StringUtils.java
index 1325ce5..3e004a6 100644 (file)
@@ -4,10 +4,10 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Pattern;
 
-
 public class StringUtils
 {
-  private static final Pattern DELIMITERS_PATTERN = Pattern.compile(".*='[^']*(?!')");
+  private static final Pattern DELIMITERS_PATTERN = Pattern
+          .compile(".*='[^']*(?!')");
 
   private static final boolean DEBUG = false;
 
@@ -25,11 +25,10 @@ public class StringUtils
    *          the character to insert
    */
   public static final char[] insertCharAt(char[] in, int position,
-          int count,
-          char ch)
+          int count, char ch)
   {
     char[] tmp = new char[in.length + count];
-  
+
     if (position >= in.length)
     {
       System.arraycopy(in, 0, tmp, 0, in.length);
@@ -39,20 +38,19 @@ public class StringUtils
     {
       System.arraycopy(in, 0, tmp, 0, position);
     }
-  
+
     int index = position;
     while (count > 0)
     {
       tmp[index++] = ch;
       count--;
     }
-  
+
     if (position < in.length)
     {
-      System.arraycopy(in, position, tmp, index,
-              in.length - position);
+      System.arraycopy(in, position, tmp, index, in.length - position);
     }
-  
+
     return tmp;
   }
 
@@ -66,7 +64,7 @@ public class StringUtils
    */
   public static final char[] deleteChars(char[] in, int from, int to)
   {
-    if (from >= in.length)
+    if (from >= in.length || from < 0)
     {
       return in;
     }