C# language please public class stringplanipulationExercise Orferences public void Execute() { Console.WriteLine("\nStri
Posted: Mon May 02, 2022 11:39 am
C# language please public class stringplanipulationExercise Orferences public void Execute() { Console.WriteLine("\nString Manipulation Exercise:"); var userData - GetText(); string[] userText - userData. Iteni; string searchTerm - userData. Item2; / Excercise I: The code above prompts the user and returns an array of text in the "userText" variable and search tern in "searchTerm" variable Use string manipulation statements to output the entered userText with the searchTerm // printed in red. Match the searchTerm using a case-insensitive search. Use the Coloririte() method to change the color of outputted text. ColorWrite() takes a color, text to print and // an optional paranter to add a newline (default fatse). ColorWrite(ConsoleColor.Blue, "\nOutput with Highlighted Search Tern:", true); //TODO: String Manipulation Exercise 1: Add code here to process and write out text. o ) #region HelperCode 3 references private void ColorWrite(ConsoleColor color, string text, bool addNewline = false) { Console. ForegroundColor - color; Console.Write(text) if (addesine) Console.WriteLine(); Console.ResetColor(); ) ference 1 private Tuple<strinet), string> GetText() ColorWrite(ConsoleColor.Blue, "Enter text (a to quit):", true); List<string> text = new List<string>(); while (true) string line - Console.ReadLine(); if (line. Tolower() == "") break; text.Add(line); ColorWrite(ConsoleColor.Blue, "Enter a search termi", true); string tern - Console.ReadLine(); return new Tuple(string), string>(text.ToArray(), term); #endregion