社区
非技术区
帖子详情
java 中如何遍历全部文件,如*.txt
yeyongji
2002-03-08 11:10:26
请dx指教.
...全文
108
4
打赏
收藏
java 中如何遍历全部文件,如*.txt
请dx指教.
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
leonzhao
2002-03-08
打赏
举报
回复
File folder = new File("C:/temp");
File[] files = folder.listFiles();
for (int i = 0;i < files.length;i++) {
if (files[i].getName().toLowerCase().endsWith(".txt"))
files[i].delete();
}
bobli2000
2002-03-08
打赏
举报
回复
去看Thinking for java 的IO流中的File.
yeyongji
2002-03-08
打赏
举报
回复
譬如我想delete *.txt 该怎样实现?
tanghuan
2002-03-08
打赏
举报
回复
class ProcFile {
public procFile(String FileName){
File file=new File(FileName);
if (file.isDirectory()){
File[] fs=file.listFile();
for(int i=0;i<fs.length;i++){
procFile(fs.getPath());
}
}else{
//处理
...
}
}
}
[leetcode]Maximal Square 和 Maximal Rectangle
刚好在实际应用
中
碰到了类似问题,大致内容是需要求一个不规则区域的最大可用的矩形区域,当时的想法是首先获得不规则区域的外接矩形,矩形的某一条边与该区域的最长的一条边重叠,然后将外接矩形划分成很多个网格,判断每个网格是否处在区域
中
,在则置为1,不在为0,再求最大的都为1的矩形区域(与Maximal Rectangle问题类似)。 Maximal Square int maximalSquare(vec...
LeetCode刷题:85. Maximal Rectangle
LeetCode刷题:85. Maximal Rectangle 原题链接:https://leetcode.com/problems/maximal-rectangle/ Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its...
【LeetCode】Maximal Rectangle
参考链接 http://blog.csdn.net/littlestream9527/article/details/19641013 题目描述 题目分析 总结 代码示例 推荐学习C++的资料 C++标准函数库 http://download.csdn.net/detail/chinasnowwolf/71
Leetcode:Maximal Square & Maximal Rectangle
url : https://leetcode.com/problems/maximal-square/description/url : https://leetcode.com/problems/maximal-rectangle/description/解题思路: Maximal Square 此题相对简单,使用动态规划。 matrix[i,j]==0时, dp[i,j]=0; matrix[
[LeetCode 84, 85]Largest Rectangle in Histogram / Maximal Rectangle
LeetCode第84,85号题,解题报告。利用栈的O(n)算法
非技术区
23,404
社区成员
70,511
社区内容
发帖
与我相关
我的任务
非技术区
Java 非技术区
复制链接
扫一扫
分享
社区描述
Java 非技术区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章