以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 如何删字WHERE后面的字符 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=171269) |
-- 作者:aoc103 -- 发布时间:2021/8/24 16:51:00 -- 如何删字WHERE后面的字符 我有一个字符串 "selec t * from (selec t * f rom a where d=1) w here id=5 and xx=dd " 希望将字符串最后一个WHERE 的后面字符删掉变成 "selec t * from (select * f rom a w here d=1)" 等于把 where id=5 and xx=dd ,w here 后面的所有字符 包括WHERE 删除 不知道要如何实现
|
-- 作者:有点蓝 -- 发布时间:2021/8/24 16:56:00 -- Dim s As String = "select * from (selec t * from a where d=1) where id=5 and xx=dd " Dim idx As Integer = s.LastIndexOf("where") If idx > -1 Then s = s.SubString(0,idx-1) End If msgbox(s) |