INDEX

Section: Linux Programmer's Manual (3)
Updated: 2019-03-06
Index JM Home Page roff page
 

名前

index, rindex - 文字列中の文字の位置を示す  

書式

#include <strings.h>

char *index(const char *s, int c);

char *rindex(const char *s, int c);
 

説明

index() 関数は、文字列 s 中に最初に文字 c が 現れた位置へのポインターを返す。

rindex() 関数は、文字列 s 中に最後に文字 c が 現れた位置へのポインターを返す。

文字列を終端するヌルバイト ('\0') は、文字列の一部とみなされる。  

返り値

index() と rindex() 関数は、一致した文字へのポインターか、 もし文字が見つからない場合は NULL を返す。  

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性
index(), rindex() Thread safetyMT-Safe
 

準拠

4.3BSD; POSIX.1-2001 では「過去の名残 (LEGACY)」と位置付けられている。 POSIX.1-2008 では index() と rindex() の仕様が削除されている。 代わりに、 strchr(3) と strrchr(3) の使用が推奨されている。  

関連項目

memchr(3), strchr(3), string(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3), strtok(3)  

この文書について

この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。


 

Index

名前
書式
説明
返り値
属性
準拠
関連項目
この文書について

This document was created by man2html, using the manual pages.
Time: 03:33:30 GMT, December 05, 2022