[Solved] How to get a character index in a string [closed]


You can iterate through the String and look for a character you seek.

Just use a for loop like this:

String test = "I want to test something";
for(int i=0;i<test.length;i++) {
  char t = test.charAt(i);
  // do something with char
}

https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#charAt%28int%29

3

solved How to get a character index in a string [closed]