I'm using Gamekit to send data via bluetooth between two devices. I want to get the name of the device that sent it, but if the name is "Bob's iPhone" I want to cut off the "'s iPhone". I first check for ending in "iPhone" or "iPod Touch".
if ([name hasSuffix:@" iPhone"])
{
name = [name substringToIndex:[name length]-7];
}
else if ([name hasSuffix:@" iPod Touch"])
{
name = [name substringToIndex:[name length]-11];
}
But when I do the same for "'s" it never returns true. Also the apostrophe looks slightly different then the default apostrophe.
if ([name hasSuffix:@"'s"])
{
name = [name substringToIndex:[name length]-2];
}
Is there some trick to detecting apostrophes? Is there a way I can do this?
EDIT: The apostrophe on the left is what name contains, but is not registering with hasSuffix:@"'s". The apostrophe on the right is the apostrophe I added.