Clover coverage report -
Coverage timestamp: Fri Jul 2 2004 18:04:44 CEST
file stats: LOC: 46   Methods: 1
NCLOC: 20   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
StringUtil.java 0% 0% 0% 0%
coverage
 1   
 /*
 2   
  * Copyright (c) 2002-2003 by OpenSymphony
 3   
  * All rights reserved.
 4   
  */
 5   
 package com.opensymphony.oscache.util;
 6   
 
 7   
 import java.util.ArrayList;
 8   
 import java.util.List;
 9   
 
 10   
 /**
 11   
  * Provides common utility methods for handling strings.
 12   
  *
 13   
  * @author <a href="&#109;a&#105;&#108;&#116;&#111;:chris&#64;swebtec.&#99;&#111;&#109;">Chris Miller</a>
 14   
  */
 15   
 public class StringUtil {
 16   
     /**
 17   
      * Splits a string into substrings based on the supplied delimiter
 18   
      * character. Each extracted substring will be trimmed of leading
 19   
      * and trailing whitespace.
 20   
      *
 21   
      * @param str The string to split
 22   
      * @param delimiter The character that delimits the string
 23   
      * @return A string array containing the resultant substrings
 24   
      */
 25  0
     public static List split(String str, char delimiter) {
 26   
         // return no groups if we have an empty string
 27  0
         if ((str == null) || "".equals(str)) {
 28  0
             return new ArrayList();
 29   
         }
 30   
 
 31  0
         ArrayList parts = new ArrayList();
 32  0
         int currentIndex;
 33  0
         int previousIndex = 0;
 34   
 
 35  0
         while ((currentIndex = str.indexOf(delimiter, previousIndex)) > 0) {
 36  0
             String part = str.substring(previousIndex, currentIndex).trim();
 37  0
             parts.add(part);
 38  0
             previousIndex = currentIndex + 1;
 39   
         }
 40   
 
 41  0
         parts.add(str.substring(previousIndex, str.length()).trim());
 42   
 
 43  0
         return parts;
 44   
     }
 45   
 }
 46