Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m8s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m8s
This commit is contained in:
commit
95769adf87
1 changed files with 1 additions and 12 deletions
|
|
@ -22,19 +22,8 @@ const { date2Thai, messageError } = useCounterMixin();
|
|||
function removeDuplicateWords(text: string): string {
|
||||
if (!text) return text;
|
||||
|
||||
// แยกคำด้วยการหาคำที่ซ้ำติดกัน
|
||||
const words = text.split(/(?=[ก-๙])/);
|
||||
const result: string[] = [];
|
||||
|
||||
for (let i = 0; i < words.length; i++) {
|
||||
const word = words[i];
|
||||
if (i === 0 || word !== words[i - 1]) {
|
||||
result.push(word);
|
||||
}
|
||||
}
|
||||
|
||||
// วิธีที่ดีกว่า: ใช้ regex เพื่อหาและลบคำที่ซ้ำ
|
||||
return text.replace(/([ก-๙]+)\1+/g, "$1");
|
||||
return text.replace(/([ก-๙]{2,})\1+/g, "$1");
|
||||
}
|
||||
|
||||
/** รับ props มาจากหน้าหลัก */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue