This commit is contained in:
kdh8219 2023-05-05 16:37:58 +09:00
parent 1d87da5802
commit f57cb242f2
No known key found for this signature in database
GPG key ID: 2B5B609E12BB4C19

View file

@ -13,15 +13,17 @@ export function dmSlice(raw: string): string[] {
if (txt.length <= 2000) {
return {
front: txt,
end: "",
end: null,
};
}
let front = txt.slice(0, 2000);
let end = txt.slice(2000, txt.length);
if (end) {
let toLast = front.slice(front.lastIndexOf("\n"), -1);
let toLastNextLine =
"" /* 공백문자 */ +
front.slice(front.lastIndexOf("\n"), front.length);
front = front.slice(0, front.lastIndexOf("\n"));
end = toLast + end;
end = toLastNextLine + end;
}
return { front, end };
}