Class: String
Instance Method Summary collapse
-
#ends_with?(other) ⇒ Boolean
Returns true iff
other
appears exactly at the end ofself
. -
#starts_with?(other) ⇒ Boolean
Returns true iff
other
appears exactly at the start ofself
.
Instance Method Details
#ends_with?(other) ⇒ Boolean
Returns true iff other
appears exactly at the end of self
.
8 9 10 |
# File 'lib/cloudist/core_ext/string.rb', line 8 def ends_with? other self[-other.length, other.length] == other end |
#starts_with?(other) ⇒ Boolean
Returns true iff other
appears exactly at the start of self
.
3 4 5 |
# File 'lib/cloudist/core_ext/string.rb', line 3 def starts_with? other self[0, other.length] == other end |