• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: hasSuffix and new line characters.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hasSuffix and new line characters.


  • Subject: Re: hasSuffix and new line characters.
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Thu, 3 Apr 2003 13:45:52 -0500

On Thursday, Apr 3, 2003, at 13:09 US/Eastern, Anthony Duer wrote:

Hi all, I seem to have run across a problem with NSString's hasSuffix method and new line characters. With the program I'm writing, I'm trying to parse a line like:

Item One \034GSM\n
ItemTwo\034GSL\n

The problem I'm having is that no matter what I've tried, hasSuffix always returns no for testing it. The problem seems to stem from the \n character. Even for testing for something simple line "none\n" returns false, even though I -know- that the newline character and none is there as the suffix for that string. Any help?


Let me make sure I've got this straight. You're doing something along the lines of:


NSString *string1 = @"none\n";

if([string1 hasSuffix: @"none"])
{
NSLog(@"Has suffix");
}
else
{
NSLog(@"Does not have suffix");
}


If that is the case, then it is right that it return false, because the string doesn't end with "none", it ends with "none\n"................................................................ .........................

--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: hasSuffix and new line characters.
      • From: Anthony Duer <email@hidden>
References: 
 >hasSuffix and new line characters. (From: Anthony Duer <email@hidden>)

  • Prev by Date: Re: Folder available check
  • Next by Date: Bringing an NSTask forward
  • Previous by thread: hasSuffix and new line characters.
  • Next by thread: Re: hasSuffix and new line characters.
  • Index(es):
    • Date
    • Thread