Can someone help me with this? I am so utterly depressed trying to figure this out that I long for my own death.

I have to create a program that asks for your name, passes that result to a method which then turns it into a username in the format initial+surname. I have tried everything to do this but i cannot get it to work. The problem is that according to my brief i must "find and store the position of the whitespace in a variable called pos". Then i must use two string variables, string1 and string2, the first to hold the first character of the name and the second to hold all characters after the space.

For the love of all that is holy i cannot understand why i am to "find and store the position of the whitespace" and how that has any relation whatsoever to making this work.



public static void string_function() {
Scanner userInput = new Scanner(System.in);
String user;

System.out.println(admin + ", this is option 1. Enter name:");
user = userInput.nextLine();
//Takes input from user and stores it in variable 'user'

create_name(user);
//Calls create_name function
}

public static create_name(String user) {

//Here i am completely lost
}