1

In my java file URL is static like

String URL = "https://aa.com/hospital/dmc.jpg";

But I want the URL will come from database like

https://aa.com/hospital/dmc.jpg

and after adding " sign at the first and the last word and put into a string. How can I get that?

June7
  • 19,874
  • 8
  • 24
  • 34

1 Answers1

1

You can do it by replace() function


    url = url.replace("https:","\"https:").replace(".jpg",".jpg\"");

You can get more information here

question

Tarlan Ahad
  • 370
  • 4
  • 15
  • Or if you want to work with more complex string that the end of it will change in order to add " you should use stringBuilder... – Tarlan Ahad Jan 04 '18 at 10:25