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();
}
}
Also in C#:
- how to switch scenes in unity
- if else statement
- Rigidbody.addforce
- open file in explorer c#
- isGrounded script for copy
- unity raycast 2d
- c# round number down
- convert string to decimal c#
- change text color wpf
- how to convert a number to 2 decimal places in c#
- c# input integer
- how to cast list to observablecollection c#
- decimal to string whole number c#
- .net core check if linux
- hash sign c sharp
- unity switch to scene and transfer data
- c# warning CS0108
- Unity C# make object face away
- how to see a tag of what you hit with raycast
- unity generate random color
- reload scene unity
- how to get value from object in c#
- c# get list of all class fields
- insert new item listview c#