Sha256: eff136b6fa1da7aa2964eff56810a175119c244a48e71b1c9e397fbeb74acf4f

Contents?: true

Size: 496 Bytes

Versions: 6

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

class String
  # Remove leading and trailing whitespace (like {String#strip}) but also all
  # inner whitespace.
  # @return [String] the whitespace-free string
  # @example
  #   "\t\n\v\f\r Hello \t\n\v\f\r World !\t\n\v\f\r ".istrip # => "HelloWorld!"
  #   '73 74 72 69 70'.istrip # => "7374726970"
  def istrip
    strip.gsub(/\s/, '')
  end

  # Remove all whitespace in place as described for {String#istrip}.
  def istrip!
    replace(innerstrip)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ctf-party-3.0.0 lib/ctf_party/misc.rb
ctf-party-2.3.0 lib/ctf_party/misc.rb
ctf-party-2.2.0 lib/ctf_party/misc.rb
ctf-party-2.1.0 lib/ctf_party/misc.rb
ctf-party-2.0.0 lib/ctf_party/misc.rb
ctf-party-1.5.0 lib/ctf_party/misc.rb