![]() |
|||
| | HOME | ご利用について | 推奨環境 | リンクに関して | 免責/規約 | お問合せ | ミスティーネット | リンク集 | | |||
|
HOME >> アルファベットで関数を検索 >> pos
pos [m//g サーチが前回行なわれた位置を返す]
[文字列処理関数]
[関数の使い方・書式]○ = pos ☆ pos ☆ = ★ ☆:スカラー変数。 [関数の機能] スカラー変数☆に対して前回 m//g によるサーチが行なわれた位置、 すなわち最後にマッチした文字列の位置を返します。 [書式の例] 1.$return = post $string; 2.pos $string = $startposition;
サンプルソース
$string = "The cost performance or this pocket reference is great!";
while ( $string =~ m/c/g ) {
$return = pos $string;
print "pos = $retrun\n";
}
【出力結果】
pos = 5
pos = 19
pos = 32
pos = 44
|
|||||||||||||||||||