字符串出现次数 [英] String occurence count
本文介绍了字符串出现次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我需要一个函数来返回另一个中已定义字符串的出现次数;
即如果搜索字符串是''预订''和主要字符串''康沃尔 - 预订,德文 - 预订,威尔斯预订''然后该功能应返回数值3.
是否有内置功能实现这个?
非常感谢提前
解决方案
我知道没有内置功能可以做到这一点但是以下应该涵盖它。我没有测试过这个,所以请告诉我是否有任何错误。
展开 | 选择 | Wrap | 行号
嗯。给出了一个无效的程序错误,并且pos变量永远不会超过1!
我没有内置的功能可以做到这一点但是以下内容应该覆盖它。我没有测试过这个,所以请告诉我是否有任何错误。
展开 | 选择 | Wrap | 行号
嗯。给出一个无效的程序错误,并且pos变量永远不会超过1!
你能否确认这是代码停止的行...
展开 | 选择 | Wrap | 行号
Hello,
I need a function to return the number of occurences of a defined string within another;
ie if the search string is ''booked'' and the main string is ''Cornwall - booked, devon - booked, wales booked'' then the function should return the numeric value of 3.
Is there a built-in function to achieve this?
Many thanks in advance解决方案There is no built in feature that I know of to do this but the following should cover it. I haven''t tested this so let me know if there are any errors.
Expand|Select|Wrap|Line Numbers
Hmmm. gives an invalid procedure error and the pos variable never goes above 1!
There is no built in feature that I know of to do this but the following should cover it. I haven''t tested this so let me know if there are any errors.
Expand|Select|Wrap|Line Numbers
Hmmm. gives an invalid procedure error and the pos variable never goes above 1!Can you confirm this is the line the code is stopping at ...
Expand|Select|Wrap|Line Numbers
这篇关于字符串出现次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆