File name abbreviation

Just Evan's icon

Hello. How can I shorten a message to a certain number of characters?

I need a length of 20 characters, followed by an "..." ellipsis.

For example:

from

"AtlasLoop_3_clap_126 [2024-09-18 040840].wav"

to

"AtlasLoop_3_clap_126..."

I think there is some kind of object that will do this quite simply )

Roman Thilenius's icon

regexp-free version:

[atoi]
[zl slice 8]
[zl group 8]
[itoa]
[sprintf %s…]

Source Audio's icon

atoi/itoa -free version

Just Evan's icon

Roman Thilenius, Thanks a lot!

I added a little logic to this, maybe it will be useful to someone)

If the name is shorter than the specified length, then we write it in full.

TFL's icon

In string fashion:

Max Patch
Copy patch and select New From Clipboard in Max.