I am working on strings in .Net Core. I have a string formatted using :n and when it is formatted the output is 123 456,00. I wanted to assert that the formatted string is equal to the string i wish it to be but i get an Assert.Equal Failure() and the problem is in the space character. In the output it asserts that the two spaces are different.
Here is my code :
public void Separator()
{
var str = string.Format("{0:n}", 123456);
Assert.Equal("123 456,00",str);
}
I also compared the space character from the formatted string to a regular space character with an assert as follows Assert.Equal(' ',str[3]);i get that the expected value is 0x00a.
Why is this happening and how can i get the same character without using string.Format()?
Assert.Equal()says123 456,00is not equal to123 456,00? Then you need to check the exact values in some hex editor. Or just use some online tool to see if there is no typo. Try r12a.github.io/apps/conversion