Documentation > CMS Template API Library > Util > Crop(String,Int32,Boolean)
Crop
Crops the specified string. If the string length is less than the crop length, the string will not be cropped. Crop tries to be smart about where it crops the string. Rather than croping a word midway through, it will crop at the right most space within the bounds set by the cropLength parameter. If a space does not exist within this section, it will crop the string at cropLength. appendEllipsis is an optional parameter that when set to true, will append an ellipsis to the end of the string. Since the ellipsis occupies 3 spaces, the cropLength will be adjusted by a factor of three. If the string is null, empty, or all whitespace, an empty string is returned.
public System.String Crop(String,Int32,Boolean)
Returns
Cropped version of the input string.
Parameters
Name | Description | Type |
---|---|---|
stringToCrop | The string to crop. | System.String |
cropLength | Max length of the string. Anything larger will result in a crop | System.Int32 |
appendEllipis | if set to true it will append an ellipis to the resultant string and it will subtract 3 from the cropLength to compensate for the 3 dots | System.Boolean |