Answers for "count duplicate characters in a string in java"

3

javascript delete first character in string

var oldStr ="Hello";
var newStr = oldStr.substring(1); //remove first character "ello"
Posted by: Guest on August-05-2019
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 "count duplicate characters in a string in java"

Code answers related to "Javascript"

Browse Popular Code Answers by Language