File name abbreviation

Just Evan's icon

Just Evan

9月 18 2024 | 1:53 午前

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

Roman Thilenius

9月 18 2024 | 4:43 午前

regexp-free version:

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

Source Audio's icon

Source Audio

9月 18 2024 | 8:54 午前

atoi/itoa -free version

Just Evan's icon

Just Evan

9月 18 2024 | 9:08 午前

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

TFL

9月 18 2024 | 11:06 午前

In string fashion:

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