01: package net.xoetrope.xui.helper;
02:
03: /**
04: * Some utilities for use with XUI
05: * <p> Copyright (c) Xoetrope Ltd., 2002-2004</p>
06: * <p> $Revision: 1.1 $</p>
07: * <p> License: see License.txt</p>
08: */
09: public class XuiUtilities {
10: /**
11: * Count the instances of a character in a string
12: * @param source the source string
13: * @param match the character to match
14: * @return the numer of instances of the match character
15: */
16: public static int count(String source, char match) {
17: int count = 0;
18: int len = source.length();
19: for (int i = 0; i < len; i++) {
20: if (source.charAt(i) == match)
21: count++;
22: }
23: return count;
24: }
25: }
|