how to check if s string is ending with specific character