ios - Objective-C: Two 'identical' strings do not match? -


I have two strings.

  NSString * Output = [[NSString alloc] initWithBytes: Buffer Length: Lane encoding:  

NSASCIIStringEncoding];

and there is a fly string created, which should match the string returned by NSStream.

I have NSLog both of them, and they are identical. I have tried to NSLog the length of the strings, and one is two letters long - even if they are the same in the 'text' form.

Any suggestions to point me in the right direction?

I have to know whether they match, as they do, to add additional functionality to my app and add another event will start.

Never use == to compare strings. If their content is similar to each other's character, then you can use excelstostring to compare two strings. If your strings have different lengths, then they are not letter-by-case characters.

Write a for loop using the method character atindex to log in and compare characters from each string 1 at a time. You may need to log the integer values ​​of the letters so that you can see information about non-printers.


Comments