Horje
c# insert spaces before capital letters Code Example
c# insert spaces before capital letters
string AddSpacesToSentence(string text, bool preserveAcronyms)
{
        if (string.IsNullOrWhiteSpace(text))
           return string.Empty;
        StringBuilder newText = new StringBuilder(text.Length * 2);
        newText.Append(text[0]);
        for (int i = 1; i < text.Length; i++)
        {
            if (char.IsUpper(text[i]))
                if ((text[i - 1] != ' ' && !char.IsUpper(text[i - 1])) ||
                    (preserveAcronyms && char.IsUpper(text[i - 1]) && 
                     i < text.Length - 1 && !char.IsUpper(text[i + 1])))
                    newText.Append(' ');
            newText.Append(text[i]);
        }
        return newText.ToString();
}




Csharp

Related
how to filter a list in c# Code Example how to filter a list in c# Code Example
c# remove all punctuation from string Code Example c# remove all punctuation from string Code Example
how to concert a list into strinf splitted by coma c# Code Example how to concert a list into strinf splitted by coma c# Code Example
hide numericUpDown arrows Code Example hide numericUpDown arrows Code Example
unity ignore collision between two objects Code Example unity ignore collision between two objects Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
15