I am receiving the data in an iPad application from a socket connected. I am converting the data received to NSString using the method below:
NSString *data = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding].
Then I am creating a substring from the string using the
NSString *substring1 = [data substringFromIndex:length-9]
NSString *substring2 = [data substringFromIndex:length-3]
where length is [data length].
Then I am comparing the substring2
with @"/>"
string as below
[substring2 compare:@"/>"]
Here I checked the value of the substring2
while debugging the application the value is @"/>"
but the comparison result is returned as NSOrderedDescending
instead of NSOrderedSame
.
Can anyone please help?