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

Hello,

i had a variable var string, for example :

image://http%3a%2f%2fwww.thetvdb.com%2fbanners%2ffanart%2foriginal%2f72227-1.jpg/

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?

Thanks

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

Maybe.
In DSL text rules you might do like this

var urlstring = "image://http%3a%2f%2fwww.thetvdb.com%2fbanners%2ffanart%2foriginal%2f72227-1.jpg/"
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