Humanizer
Humanizer copied to clipboard
FixedLengthTruncator throws exception in some cases
"Short".Truncate(100, null); will throw exception:
In the Truncate method this code casues error, because value is shorter than lenght and thus value.Substring(0, legth) throws exception
https://github.com/Humanizr/Humanizer/blob/main/src/Humanizer/Truncation/FixedLengthTruncator.cs , line 21-26 if (truncationString == null || truncationString.Length > length) { return truncateFrom == TruncateFrom.Right ? value.Substring(0, length) : value.Substring(value.Length - length); }