beboy
beboy

Reputation: 103

Data from mongoDB to java

i wanna create hyperlink to website which link is data from mongoDB

but the result of data is [ "http://thehackernews.com/2013/12/judge-ruled-nsa-telephone-metadata.html"]

how to remove [(white space)"........"]

even on java or on mongoDB

the data from mongoDB is http://thehackernews.com/2013/12/judge-ruled-nsa-telephone-metadata.html but when i print it on java the result is always [ "http://thehackernews.com/2013/12/judge-ruled-nsa-telephone-metadata.html"]

i've tried to cut the string with

String li=object.get("link").toString();

nothing succes, then i think i can set the output from mongoDB (but i dont understand), so far i just tried to cut the string from java

any solution guys?

Upvotes: 1

Views: 72

Answers (2)

hatim ahadri
hatim ahadri

Reputation: 77

Try this, it worked for me

 li = li.substring(str.indexOf("\"")+1);
    li = li.substring(0, str.indexOf("\""));

Upvotes: 1

Sanjeev Saha
Sanjeev Saha

Reputation: 2652

Could you please try the following:

String str2=li.substring(li.indexOf("\"")+1,li.lastIndexOf(("\"")));

Upvotes: 1

Related Questions