cvs: pear /Console_Color Color.php

From: Date: Sat, 12 Jun 2004 20:08:32 +0000
Subject: cvs: pear /Console_Color Color.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-20571@lists.php.net to get a copy of this message
et Sat Jun 12 16:08:32 2004 EDT Modified files: /pear/Console_Color Color.php Log: Add a function to strip color codes from a string http://cvs.php.net/diff.php/pear/Console_Color/Color.php?r1=1.2&r2=1.3&ty=u Index: pear/Console_Color/Color.php diff -u pear/Console_Color/Color.php:1.2 pear/Console_Color/Color.php:1.3 --- pear/Console_Color/Color.php:1.2 Sat Jan 17 10:18:23 2004 +++ pear/Console_Color/Color.php Sat Jun 12 16:08:32 2004 @@ -16,7 +16,7 @@ // | Authors: Stefan Walk <post@fuer-et.de> | // +----------------------------------------------------------------------+ // -// $Id: Color.php,v 1.2 2004/01/17 15:18:23 et Exp $ +// $Id: Color.php,v 1.3 2004/06/12 20:08:32 et Exp $ $GLOBALS['_CONSOLE_COLOR_CODES'] = array ( 'color' => array( @@ -252,6 +252,17 @@ */ function escape($string) { return str_replace('%', '%%', $string); + } + + /** + * Strips ANSI color codes from a string + * + * @acess public + * @param string string + * @return string + */ + function strip($string) { + return preg_replace('/\033\[[\d;]+m/','',$string); } }

« previous php.pear.cvs (#20571) next »