Replace forward slash “/ ” character in JavaScript string?

前端 未结 8 546
你的背包
你的背包 2020-12-02 15:35

I have this string:

var someString = \"23/03/2012\";

and want to replace all the \"/\" with \"-\".

I tried to do this:

<         


        
相关标签:
8条回答
  • 2020-12-02 16:03

    Remove all forward slash occurrences with blank char in Javascript.

    modelData = modelData.replace(/\//g, '');
    
    0 讨论(0)
  • 2020-12-02 16:04

    You need to escape your slash.

    /\//g
    
    0 讨论(0)
提交回复
热议问题