I perform a fuzzy search and I want to make sure, the program found the correct instance of a person.
For that reason, I compare the yielded "lastname firstname" to my expected "lastname firstname".
The code is relatively simple:
string expectedUserName = $"{nameSplit[0].ToLower()} {nameSplit[1].ToLower()}"; // result: "bechtold julian"
string result = O365Api.SearchUser(mail); // result: "bechtold julian"
if (result.Equals(expectedUserName))
{
// Correct user is found
// Never enters here
}
for the sake of testing, i also hardcoded the expected value:
userName = "bechtold julian";
mail = "julian.bechtold";
string result = O365Api.SearchUser(mail);
if (result.Equals(userName))
{
// Correct user is found
// never enters here
}
the result is the same when using a different comparing method:
if (result == userName)
and here the Values of result and username:
Am I missing out something? May the string from the web have special characters which are not shown?
What are the next steps to resolve the issue?