我想從這樣的陣列(TASK_1,TASK_2,TASK_3)中替換所有出現的“_”。
我從后端收到這個,我不能使用全部替換,因為該專案不支持 es2021。我需要像這樣顯示陣列(TASK 1,TASK 2,TASK 3)。
我試過這個方法:
formatWithoutUnderScore(valueToFormat:any) {
return valueToFormat.map((value:any) => value.replace(/_/g, ' '));
}
并使用它:
this.formatWithoutUnderScore(this.totalTasks);
但它什么也沒做:(
有人可以幫忙嗎?
uj5u.com熱心網友回復:
this.totalTasks = this.formatWithoutUnderScore(this.totalTasks);
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/531331.html
上一篇:如何在c#中用正則運算式替換兩個HTML標簽之間的所有換行符
下一篇:如何在tcl中進行自動正則運算式
