Other pages

Other software/code by me

ANSIEscapeHelper

ANSIEscapeHelper is an Objective-C class for dealing with ANSI escape sequences. Its main purpose is to translate between NSStrings that contain ANSI escape sequences and similarly formatted NSAttributedStrings.

You can read the API documentation here.

Here's a quick and simple example of how you'd most likely want to use this class:

ANSIEscapeHelper *ansiEscapeHelper =
    [[[ANSIEscapeHelper alloc] init] autorelease];

// display an ANSI-escaped string in a text view:
NSString *ansiEscapedStr =
    @"Let's pretend this string contains ANSI escape sequences";
NSAttributedString *attrStr =
    [ansiEscapeHelper
     attributedStringWithANSIEscapedString:ansiEscapedStr
     ];
[[nsTextViewInstance textStorage] setAttributedString:attrStr];

// get an ANSI-escaped string from a text view:
NSAttributedString *attrStr =
    [nsTextViewInstance textStorage];
NSString *ansiEscapedStr =
    [ansiEscapeHelper
     ansiEscapedStringWithAttributedString:attrStr
     ];

I probably won't be releasing archived packages of the code separately, so please check out the GitWeb repository browser (see below) if you want to get the code and be informed of new developments (I'll add new tags for any new versions that seem stable). If you fix something in this code or use it in your software, please let me know. Thanks.

ANSIEscapeHelper is licensed under the MIT License. Copyright © 2009 Ali Rantakari.
Source code is available in a Git repository (click here to show/hide):
 

Repository URL:
http://hasseg.org/git-public/ansiEscapeHelper.git/

Repository web page:
http://hasseg.org/gitweb?p=ansiEscapeHelper.git

Example:
cd ~/mycode
git clone http://hasseg.org/git-public/ansiEscapeHelper.git/

There are no releases of ANSIEscapeHelper out yet.