views:

209

answers:

2

I'm seeking a library, or bit of code I can incorporate into a Cocoa project where I can turn a stream of text with ansi color control codes into an attributed string. There are many projects that do this, but having examined their code they're either messy or overly complex. Has anyone an idea of a simple piece of code, or library, or framework I can use to do this simple task?

A: 

I'm not aware of a library or framework. I'd think doing so wouldn't be too hard — I'm new to Cocoa, but I'd probably go the regexen processing path.

elliottcable
I ended up using RegexKitLite which worked well enough.
naturalethic
+3  A: 

I've written a class (called ANSIEscapeHelper) to translate between NSStrings that contain ANSI escape sequences and similarly formatted NSAttributedStrings. It's released under the MIT License.

hasseg
Dude, you rock, I thought I would have to write all that color handling myself :) Thanks!
Psionides