jQuery调用WebMethod(PageMethod) NET2.0的方法
404
2024-03-07
(PHP 4, PHP 5)
count_chars — 返回字符串所用字符的信息
$string
[, int $mode
= 0
] )
统计 string
中每个字节值(0..255)出现的次数,使用多种模式返回结果。
string
需要统计的字符串。
mode
参见返回的值。
根据不同的 mode
,count_chars()
返回下列不同的结果:
0 - 以所有的每个字节值作为键名,出现次数作为值的数组。
1 - 与 0 相同,但只列出出现次数大于零的字节值。
2 - 与 0 相同,但只列出出现次数等于零的字节值。
3 - 返回由所有使用了的字节值组成的字符串。
4 - 返回由所有未使用的字节值组成的字符串。
Example #1 count_chars() 示例
<?php
$data = "Two Ts and one F.";
foreach (count_chars($data, 1) as $i => $val) {
echo "There were $val instance(s) of "" , chr($i) , "" in the string.n";
}
?>
以上例程会输出:
There were 4 instance(s) of " " in the string. There were 1 instance(s) of "." in the string. There were 1 instance(s) of "F" in the string. There were 2 instance(s) of "T" in the string. There were 1 instance(s) of "a" in the string. There were 1 instance(s) of "d" in the string. There were 1 instance(s) of "e" in the string. There were 2 instance(s) of "n" in the string. There were 2 instance(s) of "o" in the string. There were 1 instance(s) of "s" in the string. There were 1 instance(s) of "w" in the string.
strpos() - 查找字符串首次出现的位置 substr_count() - 计算字串出现的次数
#免责声明#
本站[绿夏技术导航]提供的一切软件、教程和内容信息仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络收集整理,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序或内容,请支持正版,购买注册,得到更好的正版服务。我们非常重视版权问题,如有侵权请邮件[admin@lxwl520.com]与我们联系进行删除处理。敬请谅解!