By Daniel · January 7, 2009
Trims characters from the end of a string until it is no longer than max_length. If trimming is necessary, the suffix (typically "...") will be appended on to the end of the string.
/* string_confine_length(str, max_length, suffix, count_suffix) * * Trims characters from the end of a string until it is no longer than * max_length. If trimming is necessary, the suffix (typically "...") will * be appended on to the end of the string. * * If count_suffix is true, the suffix will be counted toward the length of * the string. */ if (string_length(argument0) <= argument1) return argument0; return string_copy(argument0, 1, argument1 - argument3 * string_length(argument2)) + argument2;
Categories: String handling
There are no comments to display.
You must be signed in to post comments.