walking through a "string" full of characters: StringCharacterIterator

private int getNumberOfParameters(String ps)
   {
   		int count=0;
   		StringCharacterIterator sci = new StringCharacterIterator(ps);
   		for(char c=sci.first();c != CharacterIterator.DONE; sci.next())
   		{
   			if (c == '?')
   			{
   				count++;
   			}
   		}
   		return count;
   }//eof-function