jQuery remove special characters from string and more

后端 未结 7 1712
北荒
北荒 2020-12-12 17:58

I have a string like this:

var str = \"I\'m a very^ we!rd* Str!ng.\";

What I would like to do is removing all special characters from the a

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 18:48

    Remove/Replace all special chars in Jquery :

    If str = My name is "Ghanshyam" and from "java" background

    and want to remove all special chars (") then use it

    str=str.replace(/"/g,' ')

    result: My name is Ghanshyam and from java background

    Where g means Global @Thanks

提交回复
热议问题