|
@@ -2,15 +2,7 @@ import { showToast } from "./components/ui-lib";
|
|
import Locale from "./locales";
|
|
import Locale from "./locales";
|
|
|
|
|
|
export function trimTopic(topic: string) {
|
|
export function trimTopic(topic: string) {
|
|
- const s = topic.split("");
|
|
|
|
- let lastChar = s.at(-1); // 获取 s 的最后一个字符
|
|
|
|
- let pattern = /[,。!?、,.!?]/; // 定义匹配中文和英文标点符号的正则表达式
|
|
|
|
- while (lastChar && pattern.test(lastChar!)) {
|
|
|
|
- s.pop();
|
|
|
|
- lastChar = s.at(-1);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return s.join("");
|
|
|
|
|
|
+ return topic.replace(/[,。!?、,.!?]*$/, "");
|
|
}
|
|
}
|
|
|
|
|
|
export function copyToClipboard(text: string) {
|
|
export function copyToClipboard(text: string) {
|