I am getting below id from api,
F4EF9B435R4T9234FGHDAE34JH5TT4
I need to truncate this text to next line after exact 18 characters like this,
F4EF9B435R4T9234FG
HDAE34JH5TT4
I have tried giving maxWidth
but sometimes it is getting truncated after 18 chracters or 17 charachters.
3
Answers
One solution using CSS is as below using
max-inline-size
:Adjust the
max-inline-size
value inch
based on thefont-size
value.If possible, you can achieve the same using javascript also, like in the below code:
Use
ch
unit to truncate string after specific character length.