Answers for "all possible substrings of a string in java"

3

python3 return a list of indexes of a specific character in a string

string='mississippi'
s='s'
lst= []
for i in range(len(string)):
    if (string[i] == s):
        lst.append(i)
print(lst)
#result: [2, 3, 5, 6]
Posted by: Guest on May-07-2020
0

find all possible substrings of a string java

for (int i = 0; i < A.length(); i++) {
    for (int j = i+1; j <= A.length(); j++) {
        System.out.println(A.substring(i,j));
    }
}
Posted by: Guest on April-12-2021
2

counting the number of characters in a string java

public static void main(String[] args) {
		int wordCount = 0;
		String word = "hill";
		for (char letter = 'a'; letter <= 'z'; letter++) {
			for (int i = 0; i < word.length(); i++) {
				if (word.charAt(i) == letter) {
					wordCount++;
				}
			}
			if (wordCount > 0) {
				System.out.println(letter + "=" + wordCount);
				wordCount = 0;
			}
		}
	}
Posted by: Guest on January-23-2020

Code answers related to "all possible substrings of a string in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language