Domanda

I'm retrieving a string from an NSData object dataOut (coming from a CBCharacteristic), and defining a testString as well which is defined as the same value as shown below: enter image description here

The problem is when I try to compare the two, I get that the two strings are not equal, even though the debugger shows otherwise:

enter image description here

Here is the comparison:

enter image description here

The log keeps logging "Strings are not equal!"

What am I doing wrong? Is the encoding incorrect, even though the strings are the same?

È stato utile?

Soluzione

You will see them are different when you convert them to NSData and print out the data.

What you see is not always what you get especially with Unicode characters. There maybe invisible characters or some characters that looks similar.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top