Deleting certain amount of characters from end of value

I have images with filenames that have extensions including .jpg, .psd, .tif, and more. I would like to remove the file extension from all image file names. How can I make an expression the would remove the last 4 characters of all filenames? Using LEFT() wouldn’t work becuase all filenames are of different lengths.

There is RIGHT() function. Then you just need to create the expression to remove those characters.

Are all extensions for sure 3 characters? Because .jpg could be .jpeg as well.

If extension length is unknown. you can use the SPLIT() function and split on “.”. Since names could have periods also, then just find the LAST list item from the result of the SPLIT() and remove it.

I hope this helps! Ask questions if you need more.

1 Like

Hey @WillowMobileSystems! Fortunately, all extensions will always be 3 characters. How would I combine the RIGHT([Filename], 3) function with an expression to remove them?

No. it will identify those right three (in your case you’ll need to include the period as well).

Now you just need to create the expression so they get removed.

Not sure the correct functions. But will look.

1 Like

LEFT([Filename], LEN([Filename])-3) or maybe 4 to get rid of the ‘.’.


Perfect, thank you @Bahbus!

And thank you @WillowMobileSystems


Thanks for jumping in. I haven’t done a lot of text manipulation in AppSheet.

I was wondering…can we use subtraction like we can in Lists:

[Filename] - RIGHT([Filename], 4)

I don’t believe you can do text subtraction at all. Addition auto calls CONCATENATE(). If they were to auto call anything for subtraction, I would think it would have to be SUBSTITUTE(), which would have the unintended consequence of (potentially) removing more than intended. So they probably would never add text subtraction.