Clover coverage report - Maven Clover report
Coverage timestamp: Sun Mar 18 2007 17:42:32 CET
file stats: LOC: 70   Methods: 7
NCLOC: 55   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
StringUtils.java 83.3% 100% 85.7% 93.6%
coverage coverage
 1    package com.agical.rmock.core.util;
 2   
 3    import java.util.Iterator;
 4    import java.util.LinkedList;
 5    import java.util.List;
 6   
 7    /**
 8    * @author brolund
 9    *
 10    * (c) 2005 Agical AB
 11    */
 12    public class StringUtils {
 13  0 private StringUtils() {
 14   
 15    }
 16   
 17  6 public static List split(String string, String delimiter) {
 18  6 return split( string, delimiter, true);
 19    }
 20   
 21  20 public static List split(String string, String delimiter, boolean returnDelimiter) {
 22  20 LinkedList linkedList = new LinkedList();
 23  20 int cursor = 0;
 24  20 int index = 0;
 25  ? while( ( index = string.indexOf( delimiter, cursor )) != -1 &&
 26    cursor < string.length()-delimiter.length() ) {
 27  18 String subString = string.substring( cursor, index );
 28  18 if( subString.length() != 0 ) {
 29  15 linkedList.add( subString );
 30    }
 31  18 if( returnDelimiter ) {
 32  13 linkedList.add( delimiter );
 33    }
 34  18 cursor += delimiter.length();
 35  18 cursor += subString.length();
 36    }
 37  20 if( cursor < string.length() ) {
 38  17 linkedList.add( string.substring( cursor ) );
 39    }
 40  20 return linkedList;
 41    }
 42   
 43  14 public static String join(List list, String glue) {
 44  14 StringBuffer stringBuffer = new StringBuffer();
 45  14 for (Iterator iter = list.iterator(); iter.hasNext();) {
 46  18 stringBuffer.append( iter.next() );
 47  18 if( iter.hasNext() ) {
 48  4 stringBuffer.append( glue );
 49    }
 50   
 51    }
 52  14 return stringBuffer.toString();
 53    }
 54   
 55  13 public static String replace(String string, String find, String replacement) {
 56  13 return join( split( string, find, false ), replacement );
 57    }
 58   
 59  98 public static String capitalize(String identifier) {
 60  98 char[] characters = identifier.toCharArray();
 61  98 characters[0] = Character.toUpperCase(characters[0]);
 62  98 return String.valueOf(characters);
 63    }
 64   
 65  2 public static String decapitalize(String identifier) {
 66  2 char[] characters = identifier.toCharArray();
 67  2 characters[0] = Character.toLowerCase(characters[0]);
 68  2 return String.valueOf(characters);
 69    }
 70    }