Answers for "c# make first letter uppercase"

C#
3

c# string capitalize first letter of each word

//Try TextInfo.ToTitleCase(String) Method
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("your text");
Posted by: Guest on June-01-2021
0

c# capitalize first letter

string text = "john smith";

// "John smith"
string firstLetterOfString = text.Substring(0, 1).ToUpper() + text.Substring(1);

// "John Smith"
// Requires Linq! using System.Linq;
string firstLetterOfEachWord =
		string.Join(" ", text.Split(' ').ToList()
				.ConvertAll(word =>
						word.Substring(0, 1).ToUpper() + word.Substring(1)
				)
		);
Posted by: Guest on May-25-2020
0

c# make first letter uppercase

System.Console.WriteLine(char.ToUpper(str[0]) + str.Substring(1));
Posted by: Guest on February-20-2021
0

first sentence letter capital in c#

public static class StringExtension
{
    public static string CapitalizeFirst(this string s)
    {
        bool IsNewSentense = true;
        var result = new StringBuilder(s.Length);
        for (int i = 0; i < s.Length; i++)
        {
            if (IsNewSentense && char.IsLetter(s[i]))
            {
                result.Append (char.ToUpper (s[i]));
                IsNewSentense = false;
            }
            else
                result.Append (s[i]);

            if (s[i] == '!' || s[i] == '?' || s[i] == '.')
            {
                IsNewSentense = true;
            }
        }

        return result.ToString();
    }
}
Posted by: Guest on May-22-2020

Code answers related to "c# make first letter uppercase"

C# Answers by Framework

Browse Popular Code Answers by Language