• 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: Obtaining the number of characters in a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtaining the number of characters in a string


  • Subject: Re: Obtaining the number of characters in a string
  • From: Ron Fleckner <email@hidden>
  • Date: Mon, 21 Jul 2008 08:27:07 +1000


On 21/07/2008, at 6:26 AM, Phil Faber wrote:


On 20 Jul 2008, at 13:16, Ron Fleckner wrote:

Still struggling with documentation!

That might be because the documentation makes the reasonable assumption that you already know how to use C and Objective-C.


You're not recognising the difference between the data types 'int' and 'pointer to object'. The text field expects a pointer to an NSString. Telling it to setIntValue:someInt is just you hoping it'll work.

What you need to do is [text2 setStringValue:[NSString stringWithFormat:@"%d", [text1 length]]];

You should read the documentation, paying attention to method return types and etcetera. Also, bone up on basic C. It will help a lot.

I'm trying! Honest! I've studied 'Learn C for Cocoa' at http:// cocoadevcentral.com/articles/000081.php, and a C programming book, as well as looking up stuff on the Web but it's a very slow process. The fact that I'm dyslexic doesn't help (although that's not a good excuse) as I need to go over things again and again to 'get' them ... although once I've 'got it', it tends to stay put! Getting there. Slowly.


OK, sorry. I think I got out of the wrong side of bed that morning. As it turns out, the 'solution' I posted was wrong anyway. [text1 length] won't work because an NSTextField doesn't respond to 'length'. It should be [[text1 stringValue] length]

Happy coding,

Ron
_______________________________________________

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: 
 >Obtaining the number of characters in a string (From: Phil Faber <email@hidden>)
 >Re: Obtaining the number of characters in a string (From: Ron Fleckner <email@hidden>)
 >Re: Obtaining the number of characters in a string (From: Phil Faber <email@hidden>)

  • Prev by Date: Re: NSThread and UI
  • Next by Date: Re: Being notified of changes to a file
  • Previous by thread: Re: Obtaining the number of characters in a string
  • Next by thread: Being notified of changes to a file
  • Index(es):
    • Date
    • Thread