endsWith Not working for me.

Is it just me, but this seems over complicated, when a simple % operator would do the job?