Function Request: String.Truncate(length)

All your suggestions, requests and ideas for future development
Post Reply
jbbarnes77
Posts: 5
Joined: 26 Oct 2019, 19:56

Function Request: String.Truncate(length)

Post by jbbarnes77 »

A really helpful addition to the available functions would be one to truncate a string at a given length.

I have found that some episode titles returned by TheTVDB are unmanageable. If you want some insane examples, look at the titles of Rocky & Bullwinkle Show episodes. (The writers obviously had a lot of fun naming them.)

This causes problems in two cases I've run into:

1) Path + filename length > 256. Once renamed, these files can't be copied elsewhere because the destination path name exceeds the maximum Windows length of 256 characters.

2) Encrypted volume constraints. One of the shares on my NAS is encrypted and that limits the maximum length of any filename to 143 characters.

Thanks.
User avatar
rednoah
The Source
Posts: 22994
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Function Request: String.Truncate(length)

Post by rednoah »

e.g.

Code: Select all

{t.take(80)}
https://stackoverflow.com/a/15713996/1514467


:idea: By default, {t} is truncated at ~150 characters.
:idea: Please read the FAQ and How to Request Help.
Post Reply