--- projects/cms/source/util/uk/org/iscream/cms/util/StringUtils.java 2001/02/04 04:56:08 1.1 +++ projects/cms/source/util/uk/org/iscream/cms/util/StringUtils.java 2001/03/14 23:25:29 1.3 @@ -1,5 +1,5 @@ //---PACKAGE DECLARATION--- -package uk.ac.ukc.iscream.util; +package uk.org.iscream.util; //---IMPORTS--- import java.util.*; @@ -9,7 +9,7 @@ import java.util.*; * String objects. * * @author $Author: tdb $ - * @version $Id: StringUtils.java,v 1.1 2001/02/04 04:56:08 tdb Exp $ + * @version $Id: StringUtils.java,v 1.3 2001/03/14 23:25:29 tdb Exp $ */ public class StringUtils { @@ -18,7 +18,7 @@ public class StringUtils { /** * The current CVS revision of this class */ - public static final String REVISION = "$Revision: 1.1 $"; + public static final String REVISION = "$Revision: 1.3 $"; //---STATIC METHODS--- @@ -46,6 +46,25 @@ public class StringUtils { } return new String(textBuffer); } + + /** + * This method takes an array of String's and a + * String to look for and returns the position + * in the array that the string occurs. + * + * @param search the string to look for + * @param array the array to look in + * + * @return the position in the array + */ + public static int getStringPos(String search, String[] array) { + for(int x = 0; x < array.length; x++) { + if (array[x].equals(search)) { + return x; + } + } + return -1; + } //---CONSTRUCTORS--- @@ -55,7 +74,7 @@ public class StringUtils { * Overrides the {@link java.lang.Object#toString() Object.toString()} * method to provide clean logging (every class should have this). * - * This uses the uk.ac.ukc.iscream.util.FormatName class + * This uses the uk.org.iscream.util.FormatName class * to format the toString() * * @return the name of this class and its CVS revision