public static string ToCamelCase(this string str)
{
if (!string.IsNullOrEmpty(str) && str.Length > 1)
{
return Char.ToUpperInvariant(str[0]) + str.Substring(1);
}
return str;
}
Usage:
string text = “test data”;
string camalCaseText = text.ToCamelCase();
Output: Test data
Function declaration should be done outside of main class.