[英]System.out.println Printing itself when printing
I'm working with a list and I am trying to print the contents to see if I am getting the result that I need. 我正在使用列表,并且尝试打印内容以查看是否获得所需的结果。 But when I
println
it, the System.out.println
prints itself in it's own print (see below) 但是当我
println
时, System.out.println
以自己的打印内容打印自己(请参见下文)
09-08 12:18:23.482 7718-7718/com.example I/System.out﹕ IMAGES are: [
09-08 12:18:23.482 7718-7718/com.example I/System.out﹕ [ 09-08 12:18:23.482 7718: 7718 I/System.out ]
__,__IwjV3bxFh7ADUCcZFCLsczmadO90TKeg.jpg
09-08 12:18:23.482 7718-7718/com.example I/System.out﹕ [ 09-08 12:18:23.482 7718: 7718 I/System.out ]
__,__CmonqJYgM8hiy4mHU9UmWDbNNbI4jjcb.jpg,
09-08 12:18:23.482 7718-7718/com.example I/System.out﹕ [ 09-08 12:18:23.482 7718: 7718 I/System.out ]
__,__AonUsfgTZpcdHUg4njUtExFC53E6IKRq.jpg, , , ]
Here is the code where I print the list: 这是我打印列表的代码:
final List<String> images = db.getAPIImages();
for (String e : images){
System.out.println("IMAGES are: " + e);
}
I'm not sure if this is just an issue with Android Studio, but when I look in my db, the System.out.println
isn't being stored so I believe it's just a print issue. 我不确定这是否只是Android Studio的问题,但是当我查看数据库时,不会存储
System.out.println
因此我认为这只是打印问题。 I'd greatly appreciate some help. 非常感谢您的帮助。
USING Log.d 使用Log.d
When using Log.d, I get the following output: 使用Log.d时,得到以下输出:
09-08 12:29:15.925 13757-13757/com.example D/IMAGES are:﹕ [
n8iQYdmU4HQkVJRTvgJfen7I8mUZ7oWW.jpg
poCcNRCTKeVtxbmyGiIaq5OfFg3b5Vce.jpg, , , , ]
From looking at that, I'm guessing a new line character is present between the two jpgs. 从这个角度看,我猜这两个jpg之间存在换行符。 How can I test for that and replace with a ","?
我该如何测试并替换为“,”?
Including temp1.replace(System.getProperty("line.separator"),
has fixed my problem. Here is the full code: 包括
temp1.replace(System.getProperty("line.separator"),
修复了我的问题,这是完整的代码:
for (String e : images){
String temp = e.replaceFirst(strSeparator, "");
String temp1 = temp.replace(strSeparator, ", ");
String temp2 = temp1.replace(System.getProperty("line.separator"), "");
System.out.println("IMAGES are: " + temp2);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.