• 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: static functions in Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static functions in Objective-C


  • Subject: Re: static functions in Objective-C
  • From: Ian Anderson <email@hidden>
  • Date: Mon, 29 Aug 2005 15:45:49 -0700

I'm not sure if there's much advantage of doing this as an Objective- C class over regular C function. But you could do something like:

@interface Util : NSObject
{
}
+ (NSString *)convertIntToEnglish:(int)number;
@end

in the .h file and then in the implementation:

@implementation Util

+ (NSString *)convertIntToEnglish:(int)number
{
	/* your actual code */
}

@end

Ian


Hi all,

I am looking to write a class that will act as a utility class for simple functions. These functions will make simple "conversions." For instance, a function may take a number 1-10 and convert it to its english equivalent "one"-"ten." Say this method is called convertIntToEnglish, it takes and int and returns and NSString. The method also resides in a class called Util.

Is there a way so that I can use this method like so:

NSString* intEnglish = [Util convertIntToEnglish:1]


How would I declare this type of method? I'm not sure how to do it in Objective-C. Thanks for your help.






Bryan Bonczek
email@hidden

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

References: 
 >static functions in Objective-C (From: Bryan Bonczek <email@hidden>)

  • Prev by Date: Re: static functions in Objective-C
  • Next by Date: Re: static functions in Objective-C
  • Previous by thread: Re: static functions in Objective-C
  • Next by thread: Insensitive NSComboBox completion?
  • Index(es):
    • Date
    • Thread