Reputation: 103
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();
String[] splitStr = li.split("\\s+");
String cut=li.split("\\s");
String hasil=li.substring(li.indexOf("[")+1,li.indexOf("]"));
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
Reputation: 77
Try this, it worked for me
li = li.substring(str.indexOf("\"")+1);
li = li.substring(0, str.indexOf("\""));
Upvotes: 1
Reputation: 2652
Could you please try the following:
String str2=li.substring(li.indexOf("\"")+1,li.lastIndexOf(("\"")));
Upvotes: 1