Add SpacesTo Sentence in C#

 public string AddSpacesToSentence(string text)
    {
        if (string.IsNullOrEmpty(text))
            return "";
        StringBuilder newText = new StringBuilder(text.Length * 2);
        newText.Append(text[0]);
        for (int i = 1; i < text.Length; i++)
        {
            if (char.IsUpper(text[i]))
                newText.Append(' ');
            newText.Append(text[i]);
        }
        return newText.ToString();
    }

Comments

Popular posts from this blog

SQL Query :- Create Tables,Primary key,Foreign key,Merge Statment

AngularJS

Check folder and Delete All Files from Existing Folder in C#