Check if a string ends with something, case insensitive?

Viewed 94

I want to check if a file has a certain extension, which I can do with filename.endsWith(".ext"). But I also want to match against .EXT. How can I do this?

1 Answers

The easiest is probably filename.toLowerAscii.endsWith(".ext"). You should however consider using splitFile to get the extension and then simply compare it to ".ext" after turning it lowercase.

Related