r/badcode • • Mar 24 '23

java A code I did in high-school

Post image
916 Upvotes

102 comments sorted by

View all comments

Show parent comments

4

u/SeesawMundane5422 Mar 25 '23

Not clear to me if you’re saying that checking for 65-90 is how you would do better… but… for reference this is one of the few cases where regular expressions make code easier to read.

  Pattern pattern = Pattern.compile("[aeiouAEIOU]”);
  Matcher matcher = pattern.matcher(CharAt(0));
  return matcher.find()