0

I am trying to hard-code String but it gives me this error "Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \ )" Here is the String

value is [{"timeStamp":"11\/05\/2014 11:11:28","

how to hardcode this string? I tried but got mentioned issue.

I tried this URL invalid escape seq but not got any clue where is the issue! How can I solve this?

Thanks in advance...

Community
  • 1
  • 1
dev_android
  • 493
  • 1
  • 11
  • 29

1 Answers1

2

String value = "[{\"timeStamp\":\"11/05/2014 11:11:28\",";

There's no reason to escape / so instead of \/ you should just have /:

String value = "[{\"timeStamp\":\"11/05/2014 11:11:28\",";

EDIT

I know there is no reason but this is a fixed string and I need to do this.

If you need to preserve \/ then you do this wrong. This is correct escaping:

String value = "[{\"timeStamp\":\"11\\/05\\/2014 11:11:28\",";
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141