Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a function to strip color codes from a string

git-svn-id: http://svn.php.net/repository/pear/packages/Console_Color/trunk@161189 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 663e79b160d5c540eea6fb822d8d838317418eea 1 parent 42c3b96
Stefan Walk authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 Color.php
View
11 Color.php
@@ -254,5 +254,16 @@ 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);
+ }
+
}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.