mirror of
https://github.com/redmine/redmine.git
synced 2025-11-13 00:36:01 +01:00
12 lines
198 B
Ruby
12 lines
198 B
Ruby
|
|
class String
|
||
|
|
def starts_with?(other)
|
||
|
|
head = self[0, other.length]
|
||
|
|
head == other
|
||
|
|
end
|
||
|
|
|
||
|
|
def ends_with?(other)
|
||
|
|
tail = self[-1 * other.length, other.length]
|
||
|
|
tail == other
|
||
|
|
end
|
||
|
|
end
|