Unless you are doing this hundreds of thousands of times in a row, I doubt you will need to worry about efficiency.

By the way, now that I'm thinking about this a little more, you might also consider making an NSAttributedString and setting the kern value for the string to be a large value (e.g. five, seven, it depends on the font size) instead of putting in spaces at all. If the goal is just the visual effect of very wide character spacing, this might actually be closer to what you really have in mind.


J. Todd Slack wrote:
Hi John,

Yes, I have, Are you thinking insertString:atIndex:?

So at a basic level, can I get the string length, for loop through each
character and after each use insertString to add a space?

I am just looking for the most efficient way, sometimes I suffer from doing
things multiple ways, trying to find the most succinct and efficient versus
just making it work and optimizing later..

Jason


On 3/18/08 5:46 PM, "John Stiles" <[EMAIL PROTECTED]> wrote:

Have you looked at NSMutableString? The APIs are pretty basic here.
I'd recommend working from right-to-left; you'll find it probably makes
the logic simpler.

J. Todd Slack wrote:
Hello All,

I am a little stumped today, not sure why, but how would I add a space after
every character in an NSString and produce a new NSString from it.

So I have something like: (ignore the quotes, I just did it for containment
sake..)

³/Users/slack/Music²

And I want it to be:

³/ U s e r s / s l a c k / M u s i c ³

Would anyone have any thoughts?

Thanks!
-Jason
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jstiles%40blizzard.com

This email sent to [EMAIL PROTECTED]



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to