Look into regular expressions, which Ruby is very good at: def vowel_censor(string) string.gsub(/[aeiou]/i, "X") # case-insensitive end.
確定! 回上一頁