Substring, check if the end of a var is .jpg/


i had a variable var string, for example :


the path changes on every Movie or Tvshow. I try to check if at the end of the path is a .jpg/

i think the correct way is substring ?

can someone give me perhaps a example?


This isn’t an openhab issue, it’s how to use whichever mystery scripting language you have decided to use.

In DSL text rules you might do like this

var urlstring = "image://"
logInfo("test", "extract last 5 chars " + urlstring.substring(urlstring.length - 5))

if (urlstring.substring(urlstring.length - 5) == ".jpg/") {
	logInfo("test", "It ends with .jpg/")

but there’s always more than one way