我正在寻找一种方法来计算字符串中制表符的出现次数。
substr_count("this means nothing", "\t");
返回0,但我希望测试字符串中有两个制表位。
如果可能,我不想使用正则表达式(出于性能原因)。
提前致谢。
答案 0 :(得分:0)
$text2 = 'this means nothing';
echo substr_count($text2, 't');
答案 1 :(得分:0)
傻傻的,
像Friedrich Roell评论的那样,我的编辑确实将标签转换为空格。substr_count()工作正常。
谢谢。