using or with strings

I am trying to use a line like
"if string = '.bmp' or '.jpg' then
but I get
[DCC Warning] MAIN.PAS(376): W1058 Implicit string cast with potential data loss from 'string' to 'ShortString'

It also doesn't seem to work if I type
"if string = 'bmp' or if string = '.jpg' "then

how can I write this ?
Who is Participating?
Ephraim WangoyaConnect With a Mentor Commented:

do it like this

if (string = '.bmp') or (string = '.jpg') then
Ephraim WangoyaCommented:

if you want it cleaner, you can use AnsiIndexText

if AnsiIndexText(lowercase(yourstring), ['.bmp', '.jpg']) >= 0 then
     //your stuff

Open in new window

ChLaAuthor Commented:
That worked...Thank You
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.