I have string for instance, "John Daws Black" splitted with spaces and I need to split them to two parts so that there will be name part like "John Daws" and surname part like "Black". However the front name part can be any length like "John Erich Daws Black". My code can get the last part:
public String getSurname(String fullName){
String part = "";
for (String retval: fullName.split(" "))
part = retval;
return part;
}
But I don't know how to get the front part.