Answers for "how to count spaces java iswhitespace and charat"

1

check if a char is a space java

if (c == ' ')
Posted by: Guest on May-24-2020
0

count spaces in string java

/* let string is s*/
void countSpace(std::string s)
{
int len=s.size(); int c=0;
for(int i=0;i<len;i++)
  if(s[i]==' ') c++;
cout<<"Total Number of spae in give string is "<<c;
}
/**************************************************************************
If the user already know the total number of words that string have
then total_number_of_space_in_string = total_number_of_words_in_string - 1;
***************************************************************************/
Posted by: Guest on April-10-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language