Here you can find the source of getFirstWord(String str)
public static String getFirstWord(String str)
//package com.java2s; public class Main { public final static String SPACE = " "; public static String getFirstWord(String str) { return str.split(SPACE)[0]; }//from w w w . ja v a 2s . c o m }