remove vowel

public class Solution {
    public static String removeVowel(String s)
    {
        String t = "aeiouAEIOU";
        StringBuilder sb = new StringBuilder();
        for(char c: s.toCharArray())
        {
            if(t.indexOf(c) >= 0) continue;
            sb.append(c);
        }
        return sb.toString();
    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println(removeVowel("abcdefghijk"));
    }
 
}
StringBuffer sb = new StringBuffer();
String v = "aeiouAEIOU";
for(int i = 0; i < string.length(); i++){
    if(v.indexOf(string.charAt(i)) > -1) continue; 
    sb.append(string.charAt(i));
}
return sb.toStirng();

你可能感兴趣的:(remove vowel)