✅ Splitting string into chunks with delimiter
I am trying to split a string to fit within a character limit for my message. This works but cuts words, I was wondering if there is a way to have the chunk split in a way splits the chunk before a word on the new line.
Example data is
Current result
Desired Result
Current Code
5 Replies
you could for example cut the source to Nmax chars and then cut to the last new line (or delimiter)
but there are many ways to do it
certainly not the most beautiful...
also seems to be an off by one or something here 🙂
there we go, added some trimming and now it makes sense :p
Worked perfectly, thank you very much 🙂
it can probably be optimized a bit, but eh, it works 🙂
if you are happy, don't forget to $close
If you have no further questions, please use /close to mark the forum thread as answered