Refactor of String#end_with? comparison logic.