Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //properly capitalize a proper name
- public static string ProperlyCapitalizeName(string p)
- {
- string sResult = string.Empty;
- string sFirst = string.Empty;
- string sRemaining = string.Empty;
- p = p.Trim();
- if(p.Length >= 2)
- {
- sFirst = p.Substring(0,1).ToUpper();
- sRemaining = p.Substring(1,p.Length -1).ToLower();
- sResult = sFirst + sRemaining;
- }else{
- if(p.Length < 1)
- {
- sResult = "";
- }else{
- sResult = sFirst.ToUpper();
- }
- }
- return sResult;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement