--- 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/04 02:38:00 1.2 @@ -8,8 +8,8 @@ import java.util.*; * A class containing useful methods for manipulating * String objects. * - * @author $Author: tdb $ - * @version $Id: StringUtils.java,v 1.1 2001/02/04 04:56:08 tdb Exp $ + * @author $Author: ajm $ + * @version $Id: StringUtils.java,v 1.2 2001/03/04 02:38:00 ajm 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.2 $"; //---STATIC METHODS--- @@ -45,6 +45,25 @@ public class StringUtils { currIndex = text.indexOf(search, currIndex + search.length()); } 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---