protected String extractFirstName(String name) {
    if (StringUtils.isBlank(name)) {
      return null;
    }
    
    int lastIndexOf = name.lastIndexOf(' ');
    
    if (lastIndexOf == -1)
      return null;
    else
      return name.substring(0, lastIndexOf);
  }
protected String extractFirstName ( String name ) { if ( StringUtils . isBlank ( name ) ) { return null ; } int lastIndexOf = name . lastIndexOf ( ' ' ) ; if ( lastIndexOf == - 1 ) return null ; else return name . substring ( 0 , lastIndexOf ) ; }
Extracts a first name of full name string

@param name full name
@return first name if it could be extracted