I want to find vowels positions in the string. How can I make shorter this code?
I tried contains and indexOf method but couldn't do it.
String inputStr = "Merhaba";
ArrayList<Character> vowelsBin = new ArrayList<Character>(Arrays.asList('a', 'e', 'i', 'o', 'u'));
ArrayList<Integer> vowelsPos = new ArrayList<Integer>();
for (int inputPos = 0; inputPos < inputStr.length(); inputPos = inputPos + 1)
for (int vowelPos = 0; vowelPos < vowelsBin.size(); vowelPos = vowelPos + 1)
if (inputStr.charAt(inputPos) == vowelsBin.get(vowelPos)) vowelsPos.add(inputPos);
return vowelsPos;