Foxtable(狐表)用户栏目专家坐堂 → 删除指定字符间的字符


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

主题:删除指定字符间的字符

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


加好友 发短信
等级:三尾狐 帖子:658 积分:7902 威望:0 精华:0 注册:2013/12/11 17:49:00
删除指定字符间的字符  发帖心情 Post By:2017/6/23 13:40:00 [只看该作者]

{"item-item-1494251246528":{"title":"部门","type":"text","configvalue":"","validate":"true","un_print":"","value":"财务部"},"item-item-1494251261857":{"title":"设备名称","type":"select","configvalue":"电脑,打印机,复印机,传真机","validate":"true","un_print":"","value":"打印机"},"item-item-1494251274018":{"title":"故障描述","type":"textarea","configvalue":"","validate":"true","un_print":"","value":"卡纸"},"item-item-1494251296865":{"title":"附件","type":"file","configvalue":"","validate":"","un_print":"","value":""}}



请问一下如何删除指定字符间的字符串
例如删除 " 到 {"title": 间的字符

变成

{{"title":"部门","type":"text","configvalue":"","validate":"true","un_print":"","value":"财务部"},{"title":"设备名称","type":"select","configvalue":"电脑,打印机,复印机,传真机","validate":"true","un_print":"","value":"打印机"},{"title":"故障描述","type":"textarea","configvalue":"","validate":"true","un_print":"","value":"卡纸"},{"title":"附件","type":"file","configvalue":"","validate":"","un_print":"","value":""}}


[此贴子已经被作者于2017/6/23 14:51:44编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110813 积分:564003 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/6/23 15:01:00 [只看该作者]

Dim pattern As String = "\""item-item-\d+\"":"
Dim txt = "{""item-item-1494251246528"":{""title"":""部门"",""type"":""text"",""configvalue"":"""",""validate"":""true"",""un_print"":"""",""value"":""财务部""},""item-item-1494251261857"":{""title"":""设备名称"",""type"":""select"",""configvalue"":""电脑,打印机,复印机,传真机"",""validate"":""true"",""un_print"":"""",""value"":""打印机""},""item-item-1494251274018"":{""title"":""故障描述"",""type"":""textarea"",""configvalue"":"""",""validate"":""true"",""un_print"":"""",""value"":""卡纸""},""item-item-1494251296865"":{""title"":""附件"",""type"":""file"",""configvalue"":"""",""validate"":"""",""un_print"":"""",""value"":""""}}"
Dim rgx = new System.Text.RegularExpressions.Regex(pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase)

Output.Show(rgx.replace(txt,""))

话说回来。这种直接使用json解析即可,搞那么复杂干嘛

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


加好友 发短信
等级:三尾狐 帖子:658 积分:7902 威望:0 精华:0 注册:2013/12/11 17:49:00
  发帖心情 Post By:2017/6/23 16:45:00 [只看该作者]

谢谢! 因为看到这段代码格式跟例子的不一样 就想先转成一样的先
Dim json As String = {"item-1493982074610":{"title":"姓名","type":"text","value":"aa"},"item-1493982114963":{"title":"时间","type":"number","value":"8"},"item-1493982125642":{"title":"日期","type":"date","value":"1493913600000"}}

 回到顶部