I'm trying to calculate how many of the letter a
I have in the sentence: Hello Jordania
.
I found the function contains()
. I'm using it like this:
var phrase = "Hello Jordania";
var comptenbrdea = phrase.contains('a');
print(comptenbrdea);
As we know, I got True
as a response. I couldn't find the right function to calculate how many times I get an a
. I might be able to do something with a loop if I can check every single character? I'm lost on this.
a
, then get the length of whatever remains. – Enroot