public static string FirstCharOfEachWordToUpper(string textInfo, string seprator)
{
var spString = textInfo.Split(" ");
var s1 = seprator == " " ? "_" : seprator == "_" ? " " : seprator;
var result = "";
foreach (var item in spString)
{
string firstLetterOfString = item.Substring(0, 1).ToUpper() + item.Substring(1);
if (item != spString[spString.Length - 1])
{
result += firstLetterOfString + s1;
}
else
{
result += firstLetterOfString;
}
}
return result;
}
No comments:
Post a Comment