private static string formatSpecialNote(string text) { // 0. Prerequisite check if (String.IsNullOrEmpty(text)) { return(String.Empty); } // 1. Replace commas with spaces and trim extra spaces string trimmed = text.Replace(" ,", " ").Replace(", ", " ").Replace(",", " ").Trim(); if (String.IsNullOrEmpty(trimmed)) { return(String.Empty); } // 2. Trim prefix trimmed = trimmed.StartsWith(Program.ServiceManager.GetSpecialNotePrefix()) ? trimmed.Substring(Program.ServiceManager.GetSpecialNotePrefix().Length) : trimmed; // 3. Split in words and convert them to names var names = trimmed.Split(' ').Select(word => StringUtils.AddAtSignToLetterSubstring(word)); // 4. Combine names into a string return(String.Join(" ", names)); }