Method: Cinch::Formatting.unformat

Defined in:
lib/cinch/formatting.rb

.unformat(string) ⇒ String

Deletes all mIRC formatting codes from the string. This strips formatting for bold, underline and so on, as well as color codes. This does include removing the numeric arguments.

Parameters:

  • string (String)

    The string to filter

Returns:

  • (String)

    The filtered string

Since:

  • 2.2.0



121
122
123
# File 'lib/cinch/formatting.rb', line 121

def self.unformat(string)
  string.gsub(/[\x02\x0f\x16\x1f\x12]|\x03(\d{1,2}(,\d{1,2})?)?/, '')
end