private int countWordsInString(String s)
   {
      boolean is_space;
      boolean prev_is_space = true;
      int wc = 0;
      final int len = s.length();

      for (int i = 0; i < len; i++)
      {
         int ch = s.codePointAt(i);
         is_space = Character.isSpaceChar(s.codePointAt(i));
         if(prev_is_space && !is_space)
         {
            wc++;
         }

         prev_is_space = is_space;
      }

      return wc;
   }