English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
このメソッドは文字列内の文字のインデックス位置を返します。
str(str1,chr1)
str1 −これは検索する必要がある文字列です。
Chr1 −これは文字列内で検索する必要がある文字です。
文字列内の文字のインデックス位置を返します。
-module(helloworld). -import(string,[chr/2]). -export([start/ start() -> Str1 = "hello World", Index1 = chr(Str1]), io:fwrite("~p~n",[Index1]).
上記のプログラムを実行すると、以下のような結果が得られます。
2