Java Word Count countWords(String string)

Here you can find the source of countWords(String string)

Description

count Words

License

Open Source License

Declaration

public static int countWords(String string) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int countWords(String string) {
        return string.trim().split("\\s+").length;
    }//  www . jav  a 2  s  .com
}

Related

  1. countWords(String segment, char[] wordDelimiters)
  2. countWords(String str)
  3. countWords(String str)
  4. countWords(String string)