Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Count number of words in a String

public static void main (String[] args) {

     System.out.println("Simple Java Word Count Program");

     String str1 = "Today is Holdiay Day";

     String[] wordArray = str1.trim().split("s+");
     int wordCount = wordArray.length;

     System.out.println("Word count is = " + wordCount);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Count #number #words #String
ADD COMMENT
Topic
Name
1+3 =