1 #include <string.h>
2 #include <stdio.h>
3 main()
4 {
5 char *str="Linux was first developed for 386/486-based pcs.";
6 printf("%d\n",strspn(str,"Linux"));
7 printf("%d\n",strspn(str,"/-"));
8 printf("%d\n",strspn(str,"1234567890"));
9 } 运行结果:
5 //包含linux字符切
0 // 开始不包含
0 //开始不包含
Copy after login
The above is the detailed content of php function strspn() that returns a string containing the number of characters specified in the charlist parameter. For more information, please follow other related articles on the PHP Chinese website!
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn