Only First Letter Capital

public static string FirstLetterCapital(string strData)
{
string strReturn = string.Empty;
strReturn = strData[0].ToString().ToUpper();

for (int i = 1; i < strData.Length; i++)
{
strReturn += strData[i].ToString().ToLower();
if (strData[i] == ' ' && (i+1) < strData.Length ) //
{
strReturn += strData[i + 1].ToString().ToUpper();
i++;
}
}

return strReturn;
}
Input: WINDOWS FORMS PROGRAMMING
Output: Windows Forms Programming



 

Sandeep

a dev, an amateur photographer and a father

 

One thought on “Only First Letter Capital

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: