Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String Character Replacement



Maybe using a code like this:

NSArray * test = [myMutString componentsSeparatedByString:@":"];
NSString * newString = [test componentsJoinedByString:@"\t"];


Julio Cesar Silva dos Santos email@hidden

2006/11/10, email@hidden <email@hidden>:

What would be the most efficient way to replace characters in a string? Say I have an NSString/NSMutableString that contains...

Joe:Smith:MI:123:456:8967:M

..and I want to replace all the colons with tabs? I suppose that I could
break each field into a substring and then recombine them, but that seems
like way
too many steps for such a simple task. I need something like...

[myMutString replaceCharacter:':' with:'\t'];

Looking through the documentation of NSMutableString and NSString I didn't
find anything similar.

Thanks in advance

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >String Character Replacement (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.