Foxtable(狐表)用户栏目专家坐堂 → [求助]字符替换


  共有1469人关注过本帖树形打印复制链接

主题:[求助]字符替换

帅哥哟,离线,有人找我吗?
江南小镇
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1765 积分:11811 威望:0 精华:0 注册:2015/6/22 8:11:00
[求助]字符替换  发帖心情 Post By:2024/5/14 17:44:00 [只看该作者]

老师好,
我想把“  ”M1","M2","M2","M3","M4","M5","M6"......”替换成   “  "一月","二月","二月","三月","四月","五月","六月"......”
Dim s1() As String = {"M1","M2","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12"}
Dim s2() As String = {"一月","二月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}
Dim s As String = "编号|38|年|38|项目ID|118|M1|50|M2|50|M3|50|M4|50|M5|50|M6|50|M7|50|M8|50|M9|50|M10|50|M11|50|M12|50"
For i As Integer = 0 To s1.length - 1
s = s.replace("|" & s1(i) & "|", "|" & s2(i) & "|")
Next

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110568 积分:562730 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/5/14 20:12:00 [只看该作者]

代码有啥问题?

 回到顶部
帅哥哟,离线,有人找我吗?
江南小镇
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1765 积分:11811 威望:0 精华:0 注册:2015/6/22 8:11:00
  发帖心情 Post By:2024/5/15 6:56:00 [只看该作者]

老师好,
       没有替换掉。

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110568 积分:562730 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/5/15 8:34:00 [只看该作者]

我测试没有问题

 回到顶部
帅哥,在线噢!
cd_tdh
  5楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3205 积分:21299 威望:0 精华:0 注册:2016/3/28 16:57:00
  发帖心情 Post By:2024/5/15 8:38:00 [只看该作者]

你是不问过吗?
Dim s1()As String = {"M1", "M2", "M3", "M4", "M5", "M6", "M7", "M8", "M9", "M10", "M11", "M12"} 
Dim s2()As String = {"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" }
Dim s As String = "编号|38|年|38|项目ID|118|M1|50|M2|50|M3|50|M4|50|M5|50|M6|50|M7|50|M8|50|M9|50|M10|50|M11|50|M12|50"
For i As Integer = 0 To s1.length - 1
    s = s.replace("|" & s1(i) & "|", "|" & s2(i) & "|")
Next
msgbox(s)

 回到顶部