-3

I have a problem, because everytime i need to write indexof, i need to use + for example:

String lsdfrom2 = '[' + '"' + "LSD" + ',' + '[' + ']' + ',' + '{' + '"' + "token" + '"' + ":" + '"';

How to write it in another way? thats soo anoying to write it like in example I mean, how to read text below without write every char singly

["LSD",[],{"token":"
McGrasus
  • 31
  • 1
  • 1
  • 3

4 Answers4

4

Write it as a string (escaping the quotes is required via \")

String lsdfrom2 = "[\"LSD\",[],{\"token\":\""
Jason Down
  • 21,731
  • 12
  • 83
  • 117
2

Write is as a string literal with " to escape the quotes.

string mystring = @"[""LSD"",[],{""token"":""";
DidIReallyWriteThat
  • 1,033
  • 1
  • 10
  • 39
0

I believe you are looking to escape the quotation marks?

string lsdfrom2 = "[\"LSD\",[],{\"token\":\"";

See: Escape Sequences

ssell
  • 6,429
  • 2
  • 34
  • 49
0

You need to escape the quotes

String lsdfrom2 = "[\"LSD\",[],{\"token\":\"" // escaping the quotes..