101k views
3 votes
Write a method , getemailusername, that is passed a string argument that is an email address and returns the user-name part. so if "[email protected]" is passed, the method returns "mozart". assume that the argument will always be a correctly formatted email address.

1 Answer

4 votes
public String getemailssername (String aUser) { return aUser.substring(0, aUser.indexOf("@")); }
User Mare
by
8.9k points