-4

getting the error

error CS1009: Unrecognized escape sequence

string to be replaced

newDate = "/Date(1430370000000+0530)/"

Code

newDate.Replace("/","\/")   

I am trying to replace a backslash

/

with forward and backward slash

\/
SmartestVEGA
  • 7,601
  • 21
  • 79
  • 127

1 Answers1

0

I believe you want

newDate.Replace("/","\\/")  

as \ has special meaning and you used it improperly causing the quoted error. See escape character for more details.

Alternatively try verbatim literal using @-quoting:

newDate.Replace("/", @"\/")
Marcin Orlowski
  • 68,918
  • 10
  • 117
  • 136