Skip to content

Instantly share code, notes, and snippets.

@jimjam88
Created January 22, 2014 14:23
Show Gist options
  • Save jimjam88/8559505 to your computer and use it in GitHub Desktop.
Save jimjam88/8559505 to your computer and use it in GitHub Desktop.
Java mimic of PHP's ucfirst function
/**
* Mimics PHP's ucfirst function.
*
* @param subject The string to be ucfirst'd
* @return The subject string with an uppercased first character
*/
final public static String ucfirst(String subject)
{
return Character.toUpperCase(subject.charAt(0)) + subject.substring(1);
}
@webserveis
Copy link

Error if subect is empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment