Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (var item in splittedTxt)
- {
- if (wordToFind == item)
- {
- var cursorPositionTop = Console.CursorTop;
- var cursorPositionLeft = Console.CursorLeft;
- Console.BackgroundColor = ConsoleColor.Blue;
- Console.ForegroundColor = ConsoleColor.White;
- wordFound = true;
- foundWordPositions.Add(new CursorPosition(cursorPositionTop, cursorPositionLeft));
- }
- Console.Write(item);
- if (wordFound) // reset color
- {
- Console.BackgroundColor = ConsoleColor.Black;
- Console.ForegroundColor = ConsoleColor.Gray;
- wordFound = false;
- }
- Console.Write(" ");
- }
- //Sets the cursor to my found results
- foreach (var item in foundWordPositions)
- {
- Console.SetCursorPosition(item.CursorLeftPosition, item.CursorTopPosition);
- Console.ReadLine();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement