SHARE
TWEET

Untitled

a guest Jun 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. foreach (var item in splittedTxt)
  2.             {
  3.                 if (wordToFind == item)
  4.                 {
  5.                     var cursorPositionTop = Console.CursorTop;
  6.                     var cursorPositionLeft = Console.CursorLeft;
  7.                     Console.BackgroundColor = ConsoleColor.Blue;
  8.                     Console.ForegroundColor = ConsoleColor.White;
  9.                     wordFound = true;
  10.  
  11.  
  12.                     foundWordPositions.Add(new CursorPosition(cursorPositionTop, cursorPositionLeft));
  13.                 }
  14.                 Console.Write(item);
  15.                 if (wordFound) // reset color
  16.                 {
  17.                     Console.BackgroundColor = ConsoleColor.Black;
  18.                     Console.ForegroundColor = ConsoleColor.Gray;
  19.                     wordFound = false;
  20.  
  21.  
  22.                 }
  23.  
  24.                 Console.Write(" ");
  25.             }
  26.  
  27. //Sets the cursor to my found results
  28. foreach (var item in foundWordPositions)
  29.         {
  30.             Console.SetCursorPosition(item.CursorLeftPosition, item.CursorTopPosition);
  31.             Console.ReadLine();
  32.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top