带子串的字符串计数 [英] String count with substring
本文介绍了带子串的字符串计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello
i对子字符串的字符串数有疑问。
主字符串是java,mysql,jsp,java,html;
子字符串是这样的java,mysql
输出是这样的
java 2
mysql 1
计算子字符串的出现次数。
我该怎么办呢请帮忙做这个。
谢谢
Sang
Hello
i have a doubt in string count with the sub string.
the main string is "java,mysql,jsp,java,html";
the sub string is like this "java,mysql"
The output is like this
java 2
mysql 1
that is count the no of occureience of the sub string .
how can i do this please help to do this .
Thanks
Sang
推荐答案
你能解释一下你的问题吗?完全发布你写的任何代码或你的想法?
Could you please explain your problem a bit more fully and post any code you''ve written or ideas you have?
这是我的代码
Here is my code
展开 | 选择 | Wrap | 行号
Hello
i对子字符串的字符串计数有疑问。
主要字符串是java,mysql,jsp,java,html" ;;
子字符串是这样的java,mysql
输出是这样的
java 2
mysql 1
计算出现的数量子串。
我该怎么做才能帮忙做这件事。
谢谢
桑
Hello
i have a doubt in string count with the sub string.
the main string is "java,mysql,jsp,java,html";
the sub string is like this "java,mysql"
The output is like this
java 2
mysql 1
that is count the no of occureience of the sub string .
how can i do this please help to do this .
Thanks
Sang
你最好也看看正则表达式。
You better have a look at regular expressions too.
这篇关于带子串的字符串计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文