uTools-Manuals/docs/c/strpbrk.html
2019-04-21 11:50:48 +08:00

47 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1>字符串函数 - strpbrk</h1>
<p>原型extern char *strpbrk(char *s1, char *s2);</p>
<p>用法:#include &lt;string.h></p>
<p>功能在字符串s1中寻找字符串s2中任何一个字符相匹配的第一个字符的位置空字符NULL不包括在内。</p>
<p>说明返回指向s1中第一个相匹配的字符的指针如果没有匹配字符则返回空指针NULL。</p>
举例:<pre><code class="language-c">
// strpbrk.c
#include &lt;syslib.h>
#include &lt;string.h>
main()
{
char *s1="Welcome To Beijing";
char *s2="BIT";
char *p;
clrscr();
p=strpbrk(s1,s2);
if(p)
printf("%s\n",p);
else
printf("Not Found!\n");
p=strpbrk(s1, "Da");
if(p)
printf("%s",p);
else
printf("Not Found!");
getchar();
return 0;
}
</code></pre>相关函数:<a href="strcspn.html">strcspn</a>,<a href="strtok.html">strtok</a>