1 16 package jsp2.examples.el; 17 18 import java.util.*; 19 20 25 public class Functions { 26 public static String reverse( String text ) { 27 return new StringBuffer ( text ).reverse().toString(); 28 } 29 30 public static int numVowels( String text ) { 31 String vowels = "aeiouAEIOU"; 32 int result = 0; 33 for( int i = 0; i < text.length(); i++ ) { 34 if( vowels.indexOf( text.charAt( i ) ) != -1 ) { 35 result++; 36 } 37 } 38 return result; 39 } 40 41 public static String caps( String text ) { 42 return text.toUpperCase(); 43 } 44 } 45 | Popular Tags |