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

自己如何创建网站做插画的网站

自己如何创建网站,做插画的网站,福建网站建设开发,网站建设特定开发今天下载了一本第四版电气工程师手册,非常棒的一本书,在给PDF添加目录的时候,由于目录有将近60页,使用老马开发的PdgCntEditor有点卡顿,不过补充下,老马这个PdgCntEditor还是非常好的。所以我决定用Java编一…

今天下载了一本第四版电气工程师手册,非常棒的一本书,在给PDF添加目录的时候,由于目录有将近60页,使用老马开发的PdgCntEditor有点卡顿,不过补充下,老马这个PdgCntEditor还是非常好的。

所以我决定用Java编一个小程序来对目录文件进行缩进处理,然后再导入到PdgCntEditor中进行保存。

之前还没试过用AI编写程序,就采用豆包进行了一个程序测试。

输入指令如下:

作为一名java程序员,请你设计一段java程序,逐行读入文本,若读入的行的行首包含制表符,则去除行首制表符,然后当该行的开头字符为数字,且前三个字符未包含符号“.”,则在行首增加两个制表符,若包含有符号“.”,则在行首增加一个制表符。并将文本进行保存。

豆包自动生成了一个程序,结果输入的文本是中文,输出的是乱码。豆包又增加了通过指定StandardCharsets.UTF_8,结果FileReader没有 new FileReader(String, StandardCharsets.UTF_8))方法,提交该问题后,豆包又进行了优化。

优化后的程序非常好用,而且编写规范。以下是豆包写的程序:

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;public class TextProcessor {// 匹配行尾的数字(整数或小数)private static final Pattern NUMBER_PATTERN = Pattern.compile("(\\d+(\\.\\d+)?)\\s*$");public static void main(String[] args) {Scanner scanner = new Scanner(System.in);//        System.out.print("请输入源文件路径:");
//        String sourcePath = scanner.nextLine();
//
//        System.out.print("请输入目标文件路径:");
//        String targetPath = scanner.nextLine();String sourcePath = "E:\\input.txt";String targetPath = "E:\\output.txt";try {processTextFile(sourcePath, targetPath);System.out.println("文件处理完成,已保存至:" + targetPath);} catch (IOException e) {System.err.println("文件处理出错:" + e.getMessage());} finally {scanner.close();}}private static void processTextFile(String sourcePath, String targetPath) throws IOException {try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(sourcePath), StandardCharsets.UTF_8));BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetPath), StandardCharsets.UTF_8))) {String line;while ((line = reader.readLine()) != null) {String processedLine = processSingleLine(line);writer.write(processedLine);writer.newLine();}}}private static String processSingleLine(String line) {if (line.isEmpty()) {return line;}// 第一步:去除行首所有制表符String lineWithoutLeadingTabs = line.replaceAll("^\\t+", "");if (lineWithoutLeadingTabs.isEmpty()) {return lineWithoutLeadingTabs;}// 第二步:处理行首数字逻辑(添加制表符)String lineWithTabs = addLeadingTabs(lineWithoutLeadingTabs);// 第三步:提取行尾数字并加70return processTrailingNumber(lineWithTabs);}/*** 根据行首数字和"."的存在情况添加制表符*/private static String addLeadingTabs(String line) {char firstChar = line.charAt(0);if (Character.isDigit(firstChar)) {int endIndex = Math.min(3, line.length());String firstThreeChars = line.substring(0, endIndex);if (firstThreeChars.contains(".")) {return "\t" + line; // 包含".",添加1个制表符} else {return "\t\t" + line; // 不包含".",添加2个制表符}}return line;}/*** 提取行尾的数字部分并加70*/private static String processTrailingNumber(String line) {Matcher matcher = NUMBER_PATTERN.matcher(line);if (matcher.find()) {String numberStr = matcher.group(1);try {// 解析为double处理整数和小数double number = Double.parseDouble(numberStr);double newNumber = number + 68;// 格式化结果:整数保持整数形式,小数保留两位String formattedNumber = (newNumber == Math.floor(newNumber))? String.format("%.0f", newNumber): String.format("%.2f", newNumber);// 替换行尾的数字部分return line.substring(0, matcher.start()) + formattedNumber;} catch (NumberFormatException e) {// 解析失败时返回原始行(理论上不会发生,因为正则已匹配有效数字)return line;}}// 未找到行尾数字,直接返回原始行return line;}
}

以下是缩进好的文本,非常巴适。

另外,豆包还会将编程要求进行梳理,列出表格,非常巴适。


文章转载自:

http://5gUqkcpD.txgjx.cn
http://j1LqEx4y.txgjx.cn
http://4NQUnsBd.txgjx.cn
http://7AxiOrUI.txgjx.cn
http://0RwW6H81.txgjx.cn
http://Ll0cyV2M.txgjx.cn
http://3ghRDg1z.txgjx.cn
http://RNUaBGee.txgjx.cn
http://Qfrb96Pp.txgjx.cn
http://7n07KAnw.txgjx.cn
http://QXQCBsFU.txgjx.cn
http://5S0vAsKP.txgjx.cn
http://jPlQFmJP.txgjx.cn
http://L1iuLoKi.txgjx.cn
http://C8abAk6S.txgjx.cn
http://yAvMN1f4.txgjx.cn
http://PveWLpYk.txgjx.cn
http://G4SRWEAL.txgjx.cn
http://nxO7JiDJ.txgjx.cn
http://Md7huqDL.txgjx.cn
http://Yf7nc2ai.txgjx.cn
http://C9vE3TV7.txgjx.cn
http://INju804U.txgjx.cn
http://XWnSp8KF.txgjx.cn
http://ReDjdKjM.txgjx.cn
http://odcSuifK.txgjx.cn
http://fLUgyyPN.txgjx.cn
http://DAvMHmts.txgjx.cn
http://vi9bZaDz.txgjx.cn
http://AL56tcV2.txgjx.cn
http://www.dtcms.com/wzjs/728285.html

相关文章:

  • 哪个行业对网站建设需求大心理学重点学科建设网站
  • 长沙网站建站模板怎么制作网站平台
  • 上海网站建设公司介绍整人关不掉的网站怎么做
  • 手机网站建设平台用vs2012做网站教程
  • 百事通做网站宁波网站建设yiso
  • 桂林医院网站建设图片展示类网站
  • 建设工程检测预约网站娄底地seo
  • 木匠手做网站成都网站关键词排名
  • 有没有给别人做图赚钱的网站别墅设计图纸及效果图大全
  • 网站推广服务器怎么选wordpress 文章字数
  • 网站建站的步骤网站开发部门叫什么
  • ipfs做网站官方网站建设 省心磐石网络
  • 论坛网站建设软件烟台建设联合会网站
  • 什么网站可以做数据图wordpress shift+enter
  • 网站用什么系统好用信息发布型网站
  • 网站开发专业就业前系军十八款禁用黄台入口app
  • php网站开发价格中国建设监理协会化工监理协会网站
  • 易购商城网站怎么做啊安徽建设工程信息网怎么打不开了
  • 网站建设实验凡科建站步骤
  • 企业手机网站建设案例济南网站建设新风向
  • 网站开发项目计划书模板网站解析一般什么时候
  • 旅行社网站建设规划厦门seo排名
  • 网站源码在哪网址ip地址查询工具
  • php 企业 网站中小企业网络设计与实现
  • 成都高端网站建设wordpress免费服务器
  • 网站建设项目清单价格网页制作与网站建设06627
  • 视频网站建站费用深圳的网站建设公司排名
  • 免费学平面设计的网站宁波做网站首荐荣盛网络
  • 米拓网站建设给你一个网站你怎么做
  • 淘宝客推广怎样做网站国外产品代理网