June 20, 2012

Convert to proper case using dotnet code

Convert to proper case using dotnet code

 string sentence= "santro is my favorite car";  
 Response.Write(ConverTopropercase(sentence));  
 private static string (ConverTopropercase(string senstr)  
 {  
  return Regex.Replace(s, @"\b[a-z]\w+", delegate(Match yourMatch)  
  {  
    string Tempstr = yourMatch.ToString();  
    return char.ToUpper(Temp[0]) + Tempstr.Substring(1);  
  });  
 }  
 output:  
Santro Is My Favorite Car.