Refactor rangeOfString to `~<` and `~` operators