0

I need to create a String variable . that should be like following variable.

String search = "xmlns="http://tempuri.org/" />";

but I cannot assign xmlns="http://tempuri.org/" /> directly into a String variable because tempuri.org/" />"; get commented automatically.

I need a format this string and finally variable should be like this

search = xmlns="http://tempuri.org/" /> ;

How can I achieve this ?

Keey
  • 23
  • 1
  • 1
  • 5
  • 2
    Possible duplicate of [How to enter quotes in a Java string?](http://stackoverflow.com/questions/3559063/how-to-enter-quotes-in-a-java-string) – Kumar Abhinav Oct 22 '15 at 10:55

2 Answers2

2

You need to use escape characters:

String search = "xmlns=\"http://tempuri.org/\" />";

Version from the comments:

String search = "xmlns=\"tempuri.org/\"; /></soap:Body>";
matthias
  • 947
  • 1
  • 9
  • 27
  • Actually I need following String assign to a variable. Could you please modify the answer according to this xmlns="http://tempuri.org/" /> – Keey Oct 22 '15 at 11:17
1

You have to escape the special chars i.e replace the " for \"

String search = "xmlns=\"http://tempuri.org/\" />";
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
  • Actually I need following String assign to a variable. Could you please modify the answer according to this, – Keey Oct 22 '15 at 11:16