Additional string tests.
Methods
Public Instance methods
Does the string end with the specified suffix?
[ show source ]
# File vendor/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb, line 13
13: def ends_with?(suffix)
14: suffix = suffix.to_s
15: self[-suffix.length, suffix.length] == suffix
16: end
Does the string start with the specified prefix?
[ show source ]
# File vendor/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb, line 7
7: def starts_with?(prefix)
8: prefix = prefix.to_s
9: self[0, prefix.length] == prefix
10: end