Working with Strings
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