(swift) remove "\" character from string? -


i have string contains few \ , want remove of them. can tell me how can that. have tried stringbyreplacingoccurrencesofstring it's not working out me.

var str = "\\dagdahughuad\\dajughdaug" var str2 = str.stringbyreplacingoccurrencesofstring("\\", withstring: "", options: nsstringcompareoptions.literalsearch, range: nil) print(str2) 

this output

dagdahughuaddajughdaug 

Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -