Skip to content

Tag: indexing

How to get indexes of char in the string

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. Answer I assume you want to get m2rh5b7 from your input string Merhaba based on your code, then the below works fine, Or if you want just position of the vowels positi…

How to find the index of an element in an array in Java?

I am looking to find the index of a given element, knowing its contents, in Java. I tried the following example, which does not work: Can anyone please explain what is wrong with this and what I need to do to fix it? Answer In this case, you could create e new String from your array of chars and then