提交 2e8f0dfa 编写于 作者: R Rob Lourens

cleanup from 1f4ec255

上级 25efef4b
......@@ -674,27 +674,6 @@ export function computeLineStarts(text: string): number[] {
* Given a string and a max length returns a shorted version. Shorting
* happens at favorable positions - such as whitespace or punctuation characters.
*/
export function lcut_orig(text: string, n: number): string {
if (text.length < n) {
return text;
}
let segments = text.split(/\b/),
count = 0;
for (let i = segments.length - 1; i >= 0; i--) {
count += segments[i].length;
if (count > n) {
segments.splice(0, i);
break;
}
}
return segments.join(empty).replace(/^\s/, empty);
}
export function lcut(text: string, n: number) {
if (text.length < n) {
return text;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册