java find all of letter in string

String stringName = "Hello";
String characterToFind = "l";
//This example will find all the Ls in this string and will print the index of
//it as soon as it is detected

for(int i = 0; i < stringName.length(); i++){
  if(stringName.substring(i, i+1).equals(characterToFind)){
    System.out.println(characterToFind + "found at " + i);
  }
  
}

4.33
3
Awgiedawgie 440220 points

                                    int index = word.indexOf(guess);
while (index &gt;= 0) {
    System.out.println(index);
    index = word.indexOf(guess, index + 1);
}

4.33 (3 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to get letters of string java get letter in string java java check find all letter find all letters in string java find letters in striong java how to get a letter in a string java how to get letter of string in java index of all occurrences list java find the letter in a string java java get all indexes of substring occurrences find all characters in string java find letter from a string java java how to find letters on a string get index of all occurrences java java how to find character in string indexof all occurrences java find letter in string java java string indexof all occurrences program that find the letter of a string in java java find all char in string find all indexof java find every char in java java indexof all occurrences java indexof ending occurrences in list how to check an entire index for a character in java get all index occurences string java find letter in string searching for a character in a string java how to print every other letter in a string java find number of vowels in string java find character in string java get all numbers out of a string java how to get the all the index of a speicific character in a string java 8 how to get the all the index of a character in a string how to find all the occurence of a character in a string in java find index of repated charcter in string java how to find letters in a string java find a character in a string java how to find all occurrences of indexof in java how to get all indexes of pattern occurring how to get all indexes of pattern ocuuring java get all index of character in string how to find multiple indexes in java find all indexes of a chracter in a string java how to find all instances of a letter in a string java find index of all occurrences in string find all indexes of character in string java Indexes of all occurrences of character in a string how to index of all A's in a string java how to find all indexes of a char in a string string all index java java string findall java find all of letter in string get all indexes of character in string java
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source