how to count an replace string in java
public static void main(String[] args) throws Exception {
String word = "abcdefg";
System.out.println(word.length());
System.out.println(word.replace("a", "").length());
int a_counter = word.length() - word.replace("a", "").length();
System.out.println(a_counter);
}
Also in Java:
- how to minimize jframe in java
- java polymorphism
- change brightness of image in java
- bufferedwriter doesn't write to file
- java round double to 2 decimal places
- java print type of object
- java print syntax
- square root java
- check if string is decimal java
- how to open a text file in java
- convert array of int to arraylist java
- java treeset
- Java.awt graphics tutorial
- check last character of string java
- java remove duplicates
- java concatenate strings
- java valeur absolue
- how to create a draw Rectangle in java
- create java windows application
- how to change maven java version in po,
- java repository sql find not in list
- insert element into arraylist java
- android studio clear views of layout
- java string is null or empty