New course! Every coder should learn Generative AI!
Try a free lesson+ 7
How to count occurrence of a given character in a String?
2 Answers
+ 2
String s = "...";
int counter = 0;
for( int i=0; i<s.length(); i++ )
{
if( s.charAt(i) == '#x27; ) { counter++; }
}
0
مرحبا