分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

VB.Net制作-历朝通俗演义

发布时间:2023-09-06 01:53责任编辑:傅花花关键词:暂无标签

原先的回数,全是汉语数字,为此我先转换成了阿拉伯数字,遗憾的是阿拉伯数字100居然排在1和2之前!所以必须设置为3位数字才行!否则顺序是乱的。

以下是用VBA批量重命名的代码:

Dim FSO As New FileSystemObjectDim fd As Folder, fl As FileSub Test() ???On Error Resume Next ???For Each fd In FSO.GetFolder("E:\Office_VBA\历朝通俗演义").SubFolders ???????For Each fl In fd.Files ???????????fl.Name = D2N(fl.Name) ???????????Debug.Print fl.Name ???????Next fl ???Next fdEnd SubFunction C2N(Source As String) As String ???Const nine = "一二三四五六七八九" ???Dim temp As String ???Dim num As Integer ???If Source Like "自序*" Then ???????temp = "第0回 " & Source ???????C2N = temp ???????Exit Function ???End If ???temp = Split(Source, "回")(0) ???temp = Split(temp, "第")(1) ???If InStr(temp, "百") > 0 Then ???????num = 100 ???????temp = Right(temp, Len(temp) - 2) ???End If ???If InStr(temp, "十") = 1 Then ???????num = num + 10 ???????temp = Right(temp, Len(temp) - 1) ???End If ???If InStr(temp, "十") > 1 Then ???????num = num + 10 * InStr(nine, Left(temp, 1)) ???????temp = Right(temp, Len(temp) - 2) ???End If ???If temp <> "" Then ???????num = num + InStr(nine, Left(temp, 1)) ???End If ???C2N = "第" & num & "回" & Split(Source, "回")(1)End FunctionFunction D2N(Source As String) As String ???Dim temp As String ???temp = Split(Source, "回")(0) ???temp = Split(temp, "第")(1) ???temp = Format(temp, "000") ???D2N = "第" & temp & "回" & Split(Source, "回")(1)End Function

 

下载:

历朝通俗演义

下载后,必须解压缩,然后双击exe文件即可启动。

VB.Net制作-历朝通俗演义

原文地址:https://www.cnblogs.com/ryueifu-VBA/p/9026663.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved