check if a string ends with a particular substring