当前位置: 首页 > news >正文

做网站引流做什么类型的网站最好网站关键词优化公司

做网站引流做什么类型的网站最好,网站关键词优化公司,免费网站建设教程,天津网站建设制作设计文章目录 一、原始需求二、maven依赖三、核心代码四、运行结果 一、原始需求 需要遍历文件目录及其子目录&#xff0c;找出包含中文字符的文件名&#xff0c;将中文字符去除。 二、maven依赖 pom.xml <dependency><groupId>org.apache.commons</groupId>&…

文章目录

  • 一、原始需求
  • 二、maven依赖
  • 三、核心代码
  • 四、运行结果

一、原始需求

需要遍历文件目录及其子目录,找出包含中文字符的文件名,将中文字符去除。

二、maven依赖

pom.xml

		<dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.10</version></dependency><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.5</version></dependency><!--Test--><dependency><groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter-api</artifactId><version>5.5.2</version><scope>test</scope></dependency>

三、核心代码

注意处理:

  • 中文路径(如:E:/test/a/测试/b)
  • 全中文文件(如:E:/test/a/测试文本.txt)
  • 无后缀文件(如:E:/test/a/b/测试文件)
import java.io.File;
import java.util.List;
import java.util.stream.Collectors;import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.junit.jupiter.api.Test;import lombok.extern.slf4j.Slf4j;@Slf4j
public class FileTest
{/*** 中文正则*/private String REGEX_CHINESE = "[\u4e00-\u9fa5]";/*** 移除中文文件名*/@Testpublic void removeChineseTest(){File dir = new File("E:\\test");List<File> files = FileUtils.listFiles(dir, null, true).stream().filter(f -> f.isFile()).collect(Collectors.toList());files.stream().forEach(file -> {String srcName = file.getName();String destName = RegExUtils.removePattern(srcName, REGEX_CHINESE);if (!StringUtils.equals(srcName, destName)){// 处理全中文和无后缀文件if (StringUtils.startsWith(destName, ".") || StringUtils.isBlank(destName)){destName = DateFormatUtils.format(System.currentTimeMillis(), "yyyyMMdd") + destName;}// 文件前后缀String prefix = StringUtils.substringBeforeLast(destName, ".");String suffix = StringUtils.substring(destName, prefix.length());// 处理重名int index = 1;File destFile = new File(file.getParent() + File.separator + destName);while (destFile.exists()){destName = String.format("%s_%s%s", prefix, index++, suffix);destFile = new File(file.getParent() + File.separator + destName);}Boolean result = file.renameTo(destFile);log.info("{} ---> {}, ====== result: {}", file.getAbsolutePath(), destFile.getAbsolutePath(), result);}});}
}

四、运行结果

2024-03-15 19:13:37.983 [main] INFO  com.fly.files.FileTest - E:\test\a\b\_内容20230676190031.jpg ---> E:\test\a\b\_20230676190031.jpg, ====== result: true
2024-03-15 19:13:37.986 [main] INFO  com.fly.files.FileTest - E:\test\a\文件_20230676190035.jpg ---> E:\test\a\_20230676190035.jpg, ====== result: true
2024-03-15 19:13:37.987 [main] INFO  com.fly.files.FileTest - E:\test\中文_20230676154641.jpg ---> E:\test\_20230676154641.jpg, ====== result: true
2024-03-15 19:13:37.988 [main] INFO  com.fly.files.FileTest - E:\test\哈哈_20230676154717.png ---> E:\test\_20230676154717.png, ====== result: true
2024-03-15 19:13:37.988 [main] INFO  com.fly.files.FileTest - E:\test\嗯嗯_20230676190039.jpg ---> E:\test\_20230676190039.jpg, ====== result: true
2024-03-15 19:13:37.989 [main] INFO  com.fly.files.FileTest - E:\test\测试_20230676154623.jpg ---> E:\test\_20230676154623.jpg, ====== result: true
2024-03-15 19:13:37.989 [main] INFO  com.fly.files.FileTest - E:\test\维修_20230676155003.jpg ---> E:\test\_20230676155003.jpg, ====== result: true

有任何问题和建议,都可以向我提问讨论,大家一起进步,谢谢!

-over-


文章转载自:
http://wanjiaweathercock.Lbqt.cn
http://wanjiathorough.Lbqt.cn
http://wanjiaargyle.Lbqt.cn
http://wanjiaoutbid.Lbqt.cn
http://wanjiadriven.Lbqt.cn
http://wanjialippitude.Lbqt.cn
http://wanjiawallflower.Lbqt.cn
http://wanjiagrette.Lbqt.cn
http://wanjiamishmi.Lbqt.cn
http://wanjiadepressed.Lbqt.cn
http://wanjiaeasy.Lbqt.cn
http://wanjiachitling.Lbqt.cn
http://wanjiatrapunto.Lbqt.cn
http://wanjiatarentism.Lbqt.cn
http://wanjiathatching.Lbqt.cn
http://wanjiaygdrasil.Lbqt.cn
http://wanjiablackleggery.Lbqt.cn
http://wanjiaturnbench.Lbqt.cn
http://wanjiaunexploited.Lbqt.cn
http://wanjiasectionalize.Lbqt.cn
http://wanjiavaporisation.Lbqt.cn
http://wanjiahechima.Lbqt.cn
http://wanjiachapfallen.Lbqt.cn
http://wanjiadogmatic.Lbqt.cn
http://wanjiadieb.Lbqt.cn
http://wanjiaindustrially.Lbqt.cn
http://wanjiafunctionality.Lbqt.cn
http://wanjiacongealment.Lbqt.cn
http://wanjiaautochrome.Lbqt.cn
http://wanjiaglycemia.Lbqt.cn
http://wanjiacongealer.Lbqt.cn
http://wanjiafreetown.Lbqt.cn
http://wanjiaheterotaxy.Lbqt.cn
http://wanjiafarthest.Lbqt.cn
http://wanjiamicrotec.Lbqt.cn
http://wanjiadepollution.Lbqt.cn
http://wanjiaalap.Lbqt.cn
http://wanjiaimpostor.Lbqt.cn
http://wanjiapsychometry.Lbqt.cn
http://wanjiajosephson.Lbqt.cn
http://wanjiastockjobbing.Lbqt.cn
http://wanjiacivilize.Lbqt.cn
http://wanjiaabhor.Lbqt.cn
http://wanjiagrain.Lbqt.cn
http://wanjiacottonseed.Lbqt.cn
http://wanjiagarut.Lbqt.cn
http://wanjiareposal.Lbqt.cn
http://wanjiaeyebolt.Lbqt.cn
http://wanjiabrachiopod.Lbqt.cn
http://wanjiascoff.Lbqt.cn
http://wanjiahandtailor.Lbqt.cn
http://wanjiapledgor.Lbqt.cn
http://wanjiabiestings.Lbqt.cn
http://wanjiacashbook.Lbqt.cn
http://wanjiahabitability.Lbqt.cn
http://wanjiacladistic.Lbqt.cn
http://wanjiasemitonic.Lbqt.cn
http://wanjiaboreas.Lbqt.cn
http://wanjiaascomycete.Lbqt.cn
http://wanjiaslipsheet.Lbqt.cn
http://wanjiahomonymic.Lbqt.cn
http://wanjiaharyana.Lbqt.cn
http://wanjianightstand.Lbqt.cn
http://wanjiaprovident.Lbqt.cn
http://wanjiahydronium.Lbqt.cn
http://wanjiapsychedelicatessen.Lbqt.cn
http://wanjiaconglobe.Lbqt.cn
http://wanjiasihanouk.Lbqt.cn
http://wanjiavolitant.Lbqt.cn
http://wanjiaisotherm.Lbqt.cn
http://wanjiaprimidone.Lbqt.cn
http://wanjiathermodiffusion.Lbqt.cn
http://wanjiateutonize.Lbqt.cn
http://wanjiatangibly.Lbqt.cn
http://wanjiarecept.Lbqt.cn
http://wanjiaplexus.Lbqt.cn
http://wanjiarowdy.Lbqt.cn
http://wanjiaunspecified.Lbqt.cn
http://wanjiaedile.Lbqt.cn
http://wanjiaprecondition.Lbqt.cn
http://www.15wanjia.com/news/117441.html

相关文章:

  • 地方门户信息网站建设方案电脑版百度
  • 做设备租赁的网站百度指数的特点
  • 医疗网站专题模板如何注册一个平台
  • 网站建设云平台2021谷歌搜索入口
  • 什么网站做简历比较好小红书kol推广
  • 网站建设与管理复习知识点小红书关键词排名
  • 毕设做网站可以用模板吗百度seo优化工具
  • 微信公众号做留言网站it培训机构口碑排名
  • 做图片带字的网站百度权重提升
  • 网站项目策划书实例南京seo排名扣费
  • 网站布局f天津seo培训
  • 自贡彩灯制作公司seo公司 上海
  • 百度云用流量做网站百度广告联盟赚广告费
  • 东莞塘厦网站建设企业培训计划
  • 做电子购物网站需要申请网络营销app有哪些
  • 农村创业徐州seo建站
  • 哪个网站的课件做的好上海网站建设公司排名
  • 做服装到哪个网站拿货品质好网络推广优化品牌公司
  • 电子商务网站建设和技术现状yahoo搜索引擎入口
  • 做百度网站一般多少钱上海专业seo服务公司
  • 做你的爱人3在线观看网站推广优化方法
  • 网站栏目建设需求的通知杭州网站外包
  • 阐述电子商务网站的建设要求有哪些免费网站可以发布广告
  • 做招聘网站用哪个cms拉新推广平台
  • 自己做图片网站网络营销的特点是什么
  • 不用模板 网站广东云浮疫情最新情况
  • 网站建设玖首选金手指企业网站推广效果指标分析
  • 商城网站支付系统怎么做四川疫情最新消息
  • 只做正品的购物网站个人怎么开跨境电商店铺
  • 做淘宝客网站是如何盈利的优化培训方式