How can I delete vowels from a String except the vowel at the end of word?
For example "Please come to my party"
To return "Plse cme to my prty"
string.replaceAll("[aeiou]\\B", "")
Reads: Match all vowels ([aeiou]
) that are not followed by an "end of word" (\\B
). For more information read the Javadoc on java.util.regex.Pattern
Turn the String into a char array.
Iterate through it.
Append each character to a StringBuilder, unless the next character is an alphabetic character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With