以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 删除指定字符间的字符 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=102654) |
-- 作者:lshshlxsh -- 发布时间: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编辑过]
|
-- 作者:有点蓝 -- 发布时间: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 -- 发布时间: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"}}
|