What do you guys/gals think about the following:
var longPieceOfText = "This is some text that's too large to display into a column in a table (HTML), but should present nicely when truncated to a certain length";
Assert.That(longPieceOfText.TrimTo(10), Is.EqualTo("This is s…"));
Possible variations include trimming to the last word
Assert.That(longPieceOfText.TrimTo(10,Option.RespectWords), Is.EqualTo("This is some …"));
Trimming to the last word but respecting the length as absolute maximum
Assert.That(longPieceOfText.TrimTo(10,Option.RespectWords | ,Option.ConsiderLengthAbsolute), Is.EqualTo("This is …"));
See also https://github.com/HubSpot/humanize#truncate
If it's desirable I might start hacking on a PR this week...
What do you guys/gals think about the following:
Possible variations include trimming to the last word
Trimming to the last word but respecting the length as absolute maximum
See also https://github.com/HubSpot/humanize#truncate
If it's desirable I might start hacking on a PR this week...