🔧 文字列 ・ string.h ・ C89
strpbrk の使い方char *strpbrk(const char *s, const char *accept);
文字列の中から、指定した文字集合のいずれかが最初に現れる位置を探す。複数の区切り文字候補のうち最初に出てくるものを探したい時に使う検索関数。 見つからなければNULLを返すため、区切り文字が1つも無いプレーンな文字列の判定にも使える。
#include <string.h>
#include <stdio.h>
int main(void) {
char *p = strpbrk("key=value;next", "=;");
if (p) puts(p);
return 0;
}
アプリの関数リファレンスで引く(無料・登録不要) 関数一覧へ
strpbrk と一緒に使う関数memcmp
memcpy
memmove
memset
memset_explicit
strcat
strchr
strcmp
strcoll
strcpy
strcspn
strdup
strerror
strlen
strncat
strncmp
もっと先へ:ポインタ・メモリ・ファイル入出力・セキュアコーディングを含む全26トラックと、段位検定・模試のフルセットは完全版に収録しています。