• 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
Working with Strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Working with Strings


  • Subject: Working with Strings
  • From: Ben Jansen <email@hidden>
  • Date: Sat, 14 Jul 2001 19:30:25 -0700

Hello,
I'm attempting to port an application of mine that's already written in C++ (console-style, no GUI code) to Cocoa.
The program reads a text file into memory and runs through it, stripping it of any formatting based on a few rules. This involves checking almost all the characters in the entire file. I've got a couple questions:
1. Can I compare the return value of NSString characterAtIndex: with a normal character constant? i.e. will

if( [ myString characterAtIndex:0 ] == 'a' ) ...

evaluate correctly? If not, how can I compare characterAtIndex: with a constant?

2. What's the easiest way to append a single character to an NSString? For constants, I'm using appendString: @"<character". What's the simplest way to do this with variables?

Thanks very much,
-Ben

email@hidden


  • Follow-Ups:
    • Re: Working with Strings
      • From: Brendan Younger <email@hidden>
  • Prev by Date: NSOutlineView eats modifiers?
  • Next by Date: Re: NSAlertPanel.beginAlertSheet
  • Previous by thread: Re: NSAlertPanel.beginAlertSheet
  • Next by thread: Re: Working with Strings
  • Index(es):
    • Date
    • Thread