Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* String to split. */
- String str = "Robert King";
- String[] temp;
- String delimiter = " ";
- temp = str.split(delimiter);
- String name = temp[0];
- String surname = temp[1];
- String fullname = "Robert King";
- String[] names = fullname.split(" ", 1); // "1" means stop splitting after one space
- String firstName = names[0];
- String lastName = names[1];
- String firstName = fullName.split(" ")[0];
- String lastName = fullName.split(" ")[1];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement