字符串查找的问题

sunjian5188 2003-09-09 04:25:45
isnull(@qtyField10am1,0) as 'Qty10am1',isnull(@qtyField11am1,0)

我想在上面的字符串上查找出是否有'as'这个字符怎么做.
...全文
97 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2003-09-09
  • 打赏
  • 举报
回复
这样更简单:
Private Sub Command1_Click()
On Error Resume Next
MsgBox Split("isnull(@qtyField10am1,0) as 'Qty10am1',isnull(@qtyField11am1,0) ", "as")(1)
End Sub
of123 2003-09-09
  • 打赏
  • 举报
回复
dim p as integer
dim x as string
dim strFound as string

x = "isnull(@qtyField10am1,0) as 'Qty10am1',isnull(@qtyField11am1,0)"
p = instr(1, x,"as")

if p then
strFound = mid(x, p + 1)
p = instr(1, strFound, "'")
strFound = mid(strFound, p + 1)
p = instr(1, strFound, "'")
strfound = left(strFound, p - 1)
else
strFound = ""
end if
sunjian5188 2003-09-09
  • 打赏
  • 举报
回复
ok我知道了
haipingma 2003-09-09
  • 打赏
  • 举报
回复
mid(x,isntr(x,"as")+1)
sunjian5188 2003-09-09
  • 打赏
  • 举报
回复
那我要是想要找'as' 后面的字符那!

就是当条件满足时,就是这个字符串中有'AS' 的时候我要取他后面的字符串怎么办,谢谢先
MSSQL 2003-09-09
  • 打赏
  • 举报
回复
同意楼上的.
instr(x,"as")的返回值就是"as"在该字符串的位置.
northwolves 2003-09-09
  • 打赏
  • 举报
回复
x="isnull(@qtyField10am1,0) as 'Qty10am1',isnull(@qtyField11am1,0) "
instr(x,"as")>0 则有

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧