• 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: substringToIndex problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: substringToIndex problem


  • Subject: Re: substringToIndex problem
  • From: "Peter Karlsson" <email@hidden>
  • Date: Sat, 31 May 2003 18:57:16 +0000

Thanks, it solved my problem.

Peter


From: Prachi Gauriar <email@hidden>
To: Peter Karlsson <email@hidden>
CC: email@hidden
Subject: Re: substringToIndex problem
Date: Sat, 31 May 2003 13:49:38 -0500


On Saturday, May 31, 2003, at 01:38 PM, Peter Karlsson wrote:

Dear list!

Can someone please tell me why this does not work? All I want to do is: If the string begins with 'Loop' I want to set the string to Loop.

if ([theValue substringToIndex: 4] == @"Loop")
{
theValue = @"Loop";
}

Peter

You probably need to use [[theValue substringToIndex:4] isEqualToString:@"Loop"]. Else, it's comparing the addresses. On the other hand, why don't you try this:

if ([theValue hasPrefix:@"Loop"]) {
theValue = @"Loop";
}

Make sure you don't have any memory leaks though.

-Prachi


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail
_______________________________________________
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.
  • Prev by Date: Re: substringToIndex problem
  • Next by Date: Re: Carbon : start-up volume name/path as POSIX
  • Previous by thread: Re: substringToIndex problem
  • Next by thread: Re: simple array release error question
  • Index(es):
    • Date
    • Thread