★有个函数我忘了?就是可以得到某个字符串中某个字符的个数???

swordqj 2004-08-15 01:01:55
如:abacdefafefsdfwa

然后可以得到上边字符串的a为4个

那个函数是什么???
...全文
280 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
lihonggen0 2004-08-15
  • 打赏
  • 举报
回复
早就有人问过:
建议提问前先搜索
http://community.csdn.net/Expert/topic/3083/3083428.xml?temp=.4085199
Andy__Huang 2004-08-15
  • 打赏
  • 举报
回复
這個很好理解
dim aa as string
dim x as integer
aa = "abacdefafefsdfwa"
x = Len(a) - Len(Replace(a, "a", ""))

x為所要找的字符串的個數
northwolves 2004-08-15
  • 打赏
  • 举报
回复
ljc_zy(彷徨)结果有误,改为:

Private Sub Command1_Click()
Const x = "abacdefafefsdfwa"
MsgBox UBound(Split(x, "a"))
End Sub
xao7n 2004-08-15
  • 打赏
  • 举报
回复
'在字符串str1中查找字符串str2的出现个数
Public Function str_count(ByVal str1 As String, ByVal str2 As String) As Integer
Dim count As Integer
Dim start As Integer
Dim len_str2 As Integer
count = -1
start = 1
len_str2 = Len(str2)
Do
count = count + 1
start = InStr(start, str1, str2) + len_str2
Loop Until start = len_str2
str_count = count
End Function
xao7n 2004-08-15
  • 打赏
  • 举报
回复
//有个函数我忘了?
搞笑!好像真有这么一个函数似的
落伍者 2004-08-15
  • 打赏
  • 举报
回复
应该是
debug.print ubound(x)-1
落伍者 2004-08-15
  • 打赏
  • 举报
回复
确实高呀!
dim x
x=split(a,"a")
debug.print ubound(x)+1 '
lqtflwg718 2004-08-15
  • 打赏
  • 举报
回复
len
cdbqss1 2004-08-15
  • 打赏
  • 举报
回复
高!
hhjjhjhj 2004-08-15
  • 打赏
  • 举报
回复
a = "abacdefafefsdfwa"
b = Len(a) - Len(Replace(a, "a", ""))
MsgBox b

7,762

社区成员

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

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