You can do something similar when looking for a char
in a String
, by using the indexOf
method to search the string.
if ("aeiouAEIOU".indexOf(aChar) != -1)
More Related Contents:
- Why does the if statement “if(1)” give error in Java but it holds true in C++?
- How to count the results in a for loop?
- Will my program execute “else” even if it executed my “if”?
- I keep getting java.lang.ArrayIndexOutOfBoundsException: 5! How do I fix this? [closed]
- Performance of java if-else with return statement [duplicate]
- How to replace a char with a string
- Why is char[] preferred over String for passwords?
- Check string for palindrome
- Using switch statement with a range of value in each case?
- Java – char, int conversions
- How to convert a char to a String?
- How to convert a char array back to a string?
- Test if a string contains any of the strings from an array
- Isn’t the size of character in Java 2 bytes?
- Is there a difference in removing the curly braces from If statements in java
- Difference between “char” and “String” in Java
- What’s the default value of char?
- How to do if-else in Thymeleaf?
- Which is more effective: if (null == variable) or if (variable == null)? [duplicate]
- Using variables outside of an if-statement
- Java: If vs. Switch
- variable access outside of if statement
- Can the char type be categorized as an integer?
- How do I apply the for-each loop to every character in a String?
- How can I convert a char to int in Java? [duplicate]
- How to remove large if-else-if chain [duplicate]
- Adding char and int
- Can assign integer value to char but can’t assign integer variable to char
- Nested if-else behaviour without braces
- “Wrong” return type when using if vs. ternary opertator in Java