Issue on trimming post title

Hi, I have created and tested two different shortcodes to trim the post title, I have set them to trim at 50 characters, but both shortcodes return different title trim on different posts. Some title are trimmed at 10 characters, some title at 20 characters and some title at 30…

Why?

In the next post, I paste the two different shortcodes.

Someone can tell me what is wrong on these and what should I do to have a constant trim?

Thank you.