Re: Working with Strings
Re: Working with Strings
- Subject: Re: Working with Strings
- From: Brendan Younger <email@hidden>
- Date: Sun, 15 Jul 2001 11:01:04 -0500
1. Can I compare the return value of NSString characterAtIndex:
with a normal character constant? i.e. will
if( [ myString characterAtIndex:0 ] == 'a' ) ...
Yes, you can do this. You may also want to look into NSScanner. It
very well may replace much of your own code.
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?
Keep doing what you're doing with constants but create the string
dynamically. Check out the convenience constructors in NSString,
-stringWithCString: and -stringWithCharacters:length:
Brendan Younger