Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1x 3x 3x |
/**
* 从头开始,最大截取多少个字符串
* @param str
* @param len 最大截取多少个字符串
* @param isSpot 是否带 ...
*/
export const maxSubstrWord = (str: string, len = 5, isSpot = true): string => {
Eif (typeof str === 'string') {
return isSpot ? `${str.substr(0, len)}...` : str.substr(0, len);
} else {
return str;
}
}; |