strstr
Section: C Library Functions (3)
Updated: 2026-02-25
Index
JM Home Page
roff page
名前
strstr, strcasestr - 部分文字列の位置を示す
ライブラリ
標準 C ライブラリ (libc,~-lc)
書式
#include <string.h>
char *strstr(const char *haystack, const char *needle);
#define _GNU_SOURCE /* feature_test_macros(7) 参照 */
#include <string.h>
char *strcasestr(const char *haystack, const char *needle);
説明
The strstr() function finds the first occurrence of the substring
needle in the string haystack. The terminating null bytes
('\0') are not compared.
It is equivalent to
memmem(haystack, strlen(haystack), needle, strlen(needle))
strcasestr() 関数は strstr() 関数と同様だが、 両方の引数に対して大文字小文字を無視する。
返り値
これらの関数は、見つかった部分文字列の開始を指すポインターを返し、 もし部分文字列が見つからない場合は NULL を返す。
If needle is the empty string, the return value is always haystack
itself.
属性
この節で使用されている用語の説明については、 attributes(7) を参照。
| インターフェース | 属性 | 値
|
|
strstr()
| Thread safety | MT-Safe
|
|
strcasestr()
| Thread safety | MT-Safe locale
|
標準規格
- strstr()
-
C11, POSIX.1-2008.
- strcasestr()
-
GNU.
歴史
- strstr()
-
POSIX.1-2001, C89.
- strcasestr()
-
GNU.
関連項目
memchr(3), memmem(3), strcasecmp(3), strchr(3), string(3),
strpbrk(3), strsep(3), strspn(3), strtok(3), wcsstr(3)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- 属性
-
- 標準規格
-
- 歴史
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.