• 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: Release understanding help…
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Release understanding help…


  • Subject: Re: Release understanding help…
  • From: j o a r <email@hidden>
  • Date: Tue, 7 Dec 2004 13:27:16 +0100


On 2004-12-07, at 12.55, Thomas Davie wrote:

NSString * validChars = [[NSString alloc] initWithFormat : @"%@%@",@"0123456789mc/'\" ",[[NSUserDefaults standardUserDefaults] objectForKey:NSDecimalSeparator]];
//and remove the following line :
//validChars = [validChars stringByAppendingString:[[NSUserDefaults standardUserDefaults] objectForKey:NSDecimalSeparator]];

The alternative and possibly slightly neater and more cocoaish approach is to autorelease validChars so that it doesn't leak:


NSString* validChars = [[[NSString alloc] initWithString: @"0123456789mc/'\" "] autorelease];
validChars = [validChars stringByAppendingString:[[NSUserDefaults standardUserDefaults] objectForKey:NSDecimalSeparator]];

Even more cocoaish:

NSString *validChars = [NSString stringWithFormat: @"0123456789mc/'\" %@", [[NSUserDefaults standardUserDefaults] objectForKey: NSDecimalSeparator]];

You should probably add some sort of error checking on the value returned by NSUserDefaults before you add it to the string.

j o a r

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Release understanding help…
      • From: Thomas Davie <email@hidden>
References: 
 >Release understanding help… (From: Mark Dawson <email@hidden>)
 >Re: Release understanding help… (From: Byron Wright <email@hidden>)
 >Re: Release understanding help… (From: Thomas Davie <email@hidden>)

  • Prev by Date: Re: Release understanding help…
  • Next by Date: Re: Save Output of NSTask to file
  • Previous by thread: Re: Release understanding help…
  • Next by thread: Re: Release understanding help…
  • Index(es):
    • Date
    • Thread