我正在尝试从代表货币的数字值中删除空格。
例如,我想要将
我使用这个函数来删除
我该如何添加另一个.replace以去除数字值中的额外空格?
例如,我想要将
1 000 kr
转换为 1000
。当货币为 10 000
时也是同样情况。我使用这个函数来删除
kr
,但是当我尝试添加另一个 .replace
时它不起作用:Cypress.Commands.add('currency', (selector) => {
cy.get(selector)
.children()
.eq(1)
.invoke('text') // get text
.then((text) => +text.replace('kr', '').trim());
});
我该如何添加另一个.replace以去除数字值中的额外空格?