Hey there, I am currently utilizing Material UI in my React application and attempting to truncate text from the middle. Despite conducting thorough research and testing different methods such as adding classes like wordWrap: 'break-word'
, I have not been able to achieve the desired outcome.
Here is an example of the token:
0x3b3ch76c99f02o8k29aef20
I would like to display it in this format:
0x3b3c...aef20
While I did manage to make it work using
{token.substring(0, 5) + "..." + token.substring(20, 25)}
, this solution does not appear to be very versatile or generic.