• 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: Trying to delete the first char of a string?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to delete the first char of a string?


  • Subject: Re: Trying to delete the first char of a string?
  • From: Alastair Houghton <email@hidden>
  • Date: Mon, 29 Oct 2007 15:49:32 +0000

On 29 Oct 2007, at 15:25, Bob Ueland wrote:

-(void) awakeFromNib
{
   mstr=[NSMutableString stringWithString:@"Alabama"];

[snip]

- (void)insertText:(NSString *)input

{

   NSLog(@"The input is %@", input);

  // Delete first char
   [mstr deleteCharactersInRange: NSMakeRange (0, 1)];
   NSLog(@"%@",mstr);

}

Is garbage collection turned on? If not, the problem here is most likely that your "mstr" variable is pointing at a string that has already been released (you should do [[NSMutableString alloc] initWithString:@"Alabama"] or -retain the result of the - stringWithString: call).


Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Trying to delete the first char of a string? (From: Bob Ueland <email@hidden>)

  • Prev by Date: Re: [Leopard] Debugging GC
  • Next by Date: Re: Trying to delete the first char of a string?
  • Previous by thread: Re: Trying to delete the first char of a string?
  • Next by thread: Re: Trying to delete the first char of a string?
  • Index(es):
    • Date
    • Thread