We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The current code has the following method for splitting name to two:
public void setName(String wholeName) { String[] parts = wholeName.split(" "); this.firstName = parts[0]; if (parts.length > 1) { this.lastName = StringUtils.arrayToDelimitedString(Arrays.copyOfRange(parts, 1, parts.length), " "); } else { this.lastName = ""; } }
IMHO, the same could be done without using arrays and 3rd party libraries:
public void setName(String wholeName) { final int i = wholeName.indexOf(" "); if (i > 0) { this.firstName = wholeName.substring(0, i); this.lastName = wholeName.substring(i + 1); } else { this.firstName = wholeName; this.lastName = ""; } }
Should I submit a PR for this?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The current code has the following method for splitting name to two:
IMHO, the same could be done without using arrays and 3rd party libraries:
Should I submit a PR for this?
The text was updated successfully, but these errors were encountered: