SHARE
TWEET

Untitled

a guest Apr 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static string Capitalize(string inputValue)
  2.         {
  3.             if (String.IsNullOrEmpty(inputValue))
  4.                 return inputValue;
  5.             string result = "";
  6.             string[] words = inputValue.Split(' ');
  7.  
  8.             foreach (string word in words)
  9.             {
  10.                 if (word.Trim() != "")
  11.                 {
  12.                     if (word.Length > 1)
  13.                         result += word.Substring(0, 1).ToUpper() + word.Substring(1).ToLower() + " ";
  14.                     else
  15.                         result += word.ToUpper() + " ";
  16.                 }
  17.             }
  18.             return result.Trim();
  19.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top