美文网首页
remove vowel

remove vowel

作者: Wenyue_offer | 来源:发表于2017-09-13 14:06 被阅读0次
    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

          本文链接:https://www.haomeiwen.com/subject/vzgksxtx.html