Here you can find the source of getWordCount(String str)
public static int getWordCount(String str)
//package com.java2s; //License from project: Apache License public class Main { public static int getWordCount(String str) { str = str.replaceAll(" [^\\x00-\\xff] ", " ** "); int length = str.length(); return length; }// w w w . ja v a2 s .c o m }