fix false positive case in String#end_with?

- also, improve the efficiency of the check