Humanize.truncateWords("hello world", 2)
null
Humanize.truncateWords("hello world", 1)
"hello ..."
The primary reason one wants to use methods such as truncateWords is if the size increases beyond certain point, truncate it (and leave it untouched if input is smaller in length). Currently the method is returning null if input has less no. of words than requested.
The primary reason one wants to use methods such as
truncateWordsis if the size increases beyond certain point, truncate it (and leave it untouched if input is smaller in length). Currently the method is returningnullif input has less no. of words than requested.