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.

Solved Solved
0 7 1,022
1 ACCEPTED SOLUTION

LEFT([Filename], LEN([Filename])-3) or maybe 4 to get rid of the โ€˜.โ€™.

View solution in original post

7 REPLIES 7

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.

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.

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.

Top Labels in this Space