indexのヘルプ・マニュアル
日本語 英語
index --help
man index
INDEX(3) Linux Programmer’s Manual INDEX(3)
名前
index, rindex - 文字列中の文字の位置を示す
書式
#include
char *index(const char *s, int c);
char *rindex(const char *s, int c);
説明
index() 関数は、文字列 s 中に最初に文字 c が現れた位置へのポインタを返
す。
rindex() 関数は、文字列 s 中に最後に文字 c が現れた位置へのポインタを返
す。
文字列を終端する NULL 文字は、文字列の一部とみなされる。
返り値
index() と rindex() 関数は、一致した文字へのポインタか、もし文字が見つ
からない場合は NULL を返す。
準拠
4.3BSD; POSIX.1-2001 では「過去の名残 (LEGACY)」と位置付けられている 。
POSIX.1-2008 では index() と rindex() の仕様が削除されている。代わりに
、 strchr(3) と strrchr(3) の使用が推奨されている。
関連項目
memchr(3), strchr(3), strpbrk(3), strrchr(3), strsep(3), strspn(3),
strstr(3), strtok(3)
GNU 2009-03-15 INDEX(3)
INDEX(3) Linux Programmer’s Manual INDEX(3)
NAME
index, rindex - locate character in string
SYNOPSIS
#include
char *index(const char *s, int c);
char *rindex(const char *s, int c);
DESCRIPTION
The index() function returns a pointer to the first occurrence of the
character c in the string s.
The rindex() function returns a pointer to the last occurrence of the
character c in the string s.
The terminating NULL character is considered to be a part of the
strings.
RETURN VALUE
The index() and rindex() functions return a pointer to the matched
character or NULL if the character is not found.
CONFORMING TO
4.3BSD; marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the
specifications of index() and rindex(), recommending strchr(3) and str-
rchr(3) instead.
SEE ALSO
memchr(3), strchr(3), strpbrk(3), strrchr(3), strsep(3), strspn(3),
strstr(3), strtok(3)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2009-03-15 INDEX(3)