title: Why "White Space" not detected in a string in C#?
body: <p>I am getting very confused having this error. Below are the 2 strings I am comparing and they look exactly same in the open eyes. But when I tried to compare them in C# Code OR MS Excel, the result is "Mismatch".   </p>
  
  <pre><code>1st: Frillestads_församling_Länsräkenskaper efter 1917. Mantalslängder 1918-1991 Special 99
  
  2nd: Frillestads_församling_Länsräkenskaper efter 1917. Mantalslängder 1918-1991 Special 99  
  </code></pre>
  
  <p>Even when I tried to split them in a string array using single space (' '), the 1st line wasn't splitted.   </p>
  
  <p>Here is the C# code:  </p>
  
  <pre><code>    private void btnFindMismatch_Click(object sender, EventArgs e)
      {
          string value1 = FormattedString(txtFirstValue.Text);
          string value2 = FormattedString(txtSecondValue.Text);
  
          bool isMismatchFound = false;
  
          string[] value1Array = value1.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
          string[] value2Array = value2.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  
          for (int i = 0; i &lt; value1Array.Length; i++)
          {
              if(value1Array[i].Equals(value2Array[i]) == false)
              {
                  lblResult.Text = string.Format("Mismatch in index: {0}; 1st Char: {1}; 2nd Char: {2}", i, value1Array[i], value2Array[i]);
                  isMismatchFound = true;
  
                  break;
              }
          }
  
          if(!isMismatchFound)
          {
              lblResult.Text = "No Mismatch";
          }
  
          MessageBox.Show("Complete");
      }
  
      private string FormattedString(string value)
      {
          RegexOptions options = RegexOptions.None;
          Regex regex = new Regex(@"[ ]{2,}", options);
          value = regex.Replace(value, @" ");
  
          return value;
      }  
  </code></pre>
  
  <p>I then tried to check the 1st value in notepad++ and then found that, the 1st string did not contain any "White Space".  </p>
  
  <p>Please see below screen shots for more clearer view.   </p>
  
  <p><img src="https://i.stack.imgur.com/tXYHV.jpg" alt="C# Code output"></p>
  
  <p><img src="https://i.stack.imgur.com/4T2JI.jpg" alt="Notepad++ Search output"></p>