How to remove whitespace in text

后端 未结 5 1233
夕颜
夕颜 2021-01-17 18:01

How can I trim a text string in my Angular application?

Example

{{ someobject.name }}  

someobject.name results in \"name abc\"

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-17 18:23

    Replace all the whitespace between string

    let spaceReg = new RegExp(" ",'g');

    let str = "name abc"

    str = str.replace(spaceReg,"");

提交回复
热议问题