I've migrated Magento 1 to Magento 2, In the Magento 1 site on product listing page I've truncated the length of the short description.
e.g- echo Mage::helper('core/string')->truncate($short_description, '120');
I require the same thing in Magento 2 way, how can I achieve it?
Note:- I don't want to use simple core PHP to restrict length.
Best Answer
You can truncate string in Magento-2 by below code
Inject below parameters to your class __construct
You can truncate string by below code