There may be edge cases you must deal with unless you can absolutely
guarantee the form of your input. For example, while Cocoa uses lower camel
case in most places, it also contains method names like +[NSURL
URLWithString:].
-Chad
On 9/12/11 7:39 PM, Conrad Shultz
Hi all,
I am trying to use NSScanner to change camel cased strings into
underscore delimited strings, e.g featuredListingId to
featured_listing_id
I have worked our how to use NSScanner to achieve this, consider my
implementation (implemented as a NSString category)
- (NSString *)
On 2011 Sep 12, at 07:01, Devraj Mukherjee wrote:
Can I ask NSScanner to keep looking for multiple occurrences?
Use something like
while (![scanner isAtEnd])
{
// your code
}
And be careful to consider all possibilities so you can't get an infinite
Typed into mail (no guarantee):
NSScanner* scanner = [NSScanner scannerWithString:input];
NSMutableString* output = [NSMutableString string];
NSString* temp;
[scanner setCaseSensitive:YES];
while( ![scanner isAtEnd])
{
if([scanner scanUpToCharactersFromSet:[NSCharacterSet
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 9/12/11 7:01 AM, Devraj Mukherjee wrote:
Hi all,
I am trying to use NSScanner to change camel cased strings into
underscore delimited strings, e.g featuredListingId to
featured_listing_id
In addition to the responses you have already