这里有什么问题?
for (File f: list){
Log.e("dir", f.getName());
String foldername = f.getName().trim();
if(foldername != "Test"){
Log.e("dir_repeat",foldername);
}
}
为什么即使文件夹名称为 测试 ,
也会收到 dir_repeat我想根据名字跳过列表中的一些文件夹。
答案 0 :(得分:1)
您应该使用equals()
for (File f: list){
Log.e("dir", f.getName());
String foldername = f.getName().trim();
if(foldername.equals("Test"))
{
Log.e("dir_repeat",foldername);
}
}
<table>
<tr>
<td>
<div style="border: 1px solid blue; background-color: #99CCFF; padding: 5px; width: 150px;">
<a id="myHeader1" href="javascript:showonlyone('newboxes1');" >show this one only</a>
</div>
<div class="newboxes" id="newboxes1" style="border: 1px solid black; background-color: #CCCCCC; display: block;padding: 5px; width: 150px;">Div #1</div>
</td>
<td>
<div style="border: 1px solid blue; background-color: #99CCFF; padding: 5px; width: 150px;">
<a id="myHeader2" href="javascript:showonlyone('newboxes2');" >show this one only</a>
</div>
<div class="newboxes" id="newboxes2" style="border: 1px solid black; background-color: #CCCCCC; display: none;padding: 5px; width: 150px;">Div #2</div>
</td>
<td>
<div style="border: 1px solid blue; background-color: #99CCFF; padding: 5px; width: 150px;">
<a id="myHeader3" href="javascript:showonlyone('newboxes3');" >show this one only</a>
</div>
<div class="newboxes" id="newboxes3" style="border: 1px solid black; background-color: #CCCCCC; display: none;padding: 5px; width: 150px;">Div #3</div>
</td>
</tr>
</table>
请参阅此链接Why Dead code warning