Hi ,
I will receive a string ,i need to check if that string contains image extensions like (.img,.jpg , .jpeg ). set flag if there is image extension in file.
Please help
Hi ,
I will receive a string ,i need to check if that string contains image extensions like (.img,.jpg , .jpeg ). set flag if there is image extension in file.
Please help
You can use System.Text.RegularExpressions.Regex.IsMatch(YourString,“jpg|img|jpeg”).Tostring
cheers
Can you share the input string here
Checkout this steps
System.Text.RegularExpressions.Regex.IsMatch(StrVar,String.Join("|",arrStrFormats))
Regards
Sudharsan
@tharani.natarajan
StrVar = DemoFile.png or Files full path like Folder\DemoFile.png
Regards
Sudharsan
in general we can retrieve the extension like the foolowing (one of more options)
with a list and some additions we can do:
arrIMGExtensions = {“.img”,”.jpg",“.jpeg”,“.png”}
arrIMGExtensions .Contains(Path.GetExtension(YourString).toLower)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.