Sha256: 4e118eea640749588985e22388131b96fffb12e873dc28ae40ae5316bf223e9b

Contents?: true

Size: 256 Bytes

Versions: 10

Compression:

Stored size: 256 Bytes

Contents

class String

  def starts_with?(prefix)
    pattern = Regexp.new "^#{Regexp.escape(prefix)}"
    not ( pattern =~ self ).nil?
  end

  def ends_with?(suffix)
    pattern = Regexp.new "#{Regexp.escape(suffix)}$"
    not ( pattern =~ self ).nil?
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tagomatic-0.1.9 lib/monkey/string.rb
tagomatic-0.1.8 lib/monkey/string.rb
tagomatic-0.1.7 lib/monkey/string.rb
tagomatic-0.1.6 lib/monkey/string.rb
tagomatic-0.1.5 lib/monkey/string.rb
tagomatic-0.1.4 lib/monkey/string.rb
tagomatic-0.1.3 lib/monkey/string.rb
tagomatic-0.1.2 lib/monkey/string.rb
tagomatic-0.1.1 lib/monkey/string.rb
tagomatic-0.1.0 lib/monkey/string.rb