简体   繁体   English

从mongoDB到Java的数据

[英]Data from mongoDB to java

i wanna create hyperlink to website which link is data from mongoDB 我想创建到网站的超链接,该链接是来自mongoDB的数据

but the result of data is [ "http://thehackernews.com/2013/12/judge-ruled-nsa-telephone-metadata.html"] 但数据的结果为[ "http://thehackernews.com/2013/12/judge-ruled-nsa-telephone-metadata.html"]

how to remove [(white space)"........"] 如何删除[(空白)“ ........”]

even on java or on mongoDB 即使在Java或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"] 来自mongoDB的数据为http://thehackernews.com/2013/12/judge-ruled-nsa-telephone-metadata.html但是当我在Java上打印时,结果始终为[ "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 没有成功,那么我想我可以设置mongoDB的输出(但是我不明白),到目前为止,我只是试图从java中剪切字符串

any solution guys? 有解决方案的人吗?

您能否尝试以下方法:

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

Try this, it worked for me 试试这个,对我有用

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM