Module: BB::String
- Defined in:
- lib/blackbox/string.rb
Overview
String utilities.
Class Method Summary (collapse)
-
+ (String) strip_ansi(text)
Strip ANSI escape sequences from String.
Class Method Details
+ (String) strip_ansi(text)
Strip ANSI escape sequences from String.
10 11 12 13 14 |
# File 'lib/blackbox/string.rb', line 10 def strip_ansi(text) text.gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, '') .gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, '') .gsub(/(\x03|\x1a)/, '') end |