JavaScript 文字列操作 新しいページはコチラ

提供: yonewiki
移動: 案内, 検索
(文字列検索(文字列変数後方検索) lastIndexOf)
(文字列検索(文字列変数後方検索) lastIndexOf)
681行: 681行:
  
 
== '''文字列検索(文字列変数後方検索) lastIndexOf ''' ==
 
== '''文字列検索(文字列変数後方検索) lastIndexOf ''' ==
*nPosition = strData17.lastIndexOf("麻薬",0)
+
*nPosition = strData17.lastIndexOf("麻薬", strData18.length - 1)
  
  
688行: 688行:
  
 
:*第一引数:検索文字列
 
:*第一引数:検索文字列
:*第二引数:検索開始位置 0なら先頭。※省略も可能(省略時は0が適用)
+
:*第二引数:検索開始位置 0なら先頭。※省略も可能(省略時は最後尾が適用, xxx.length - 1と同じことです)
  
  
695行: 695行:
 
strData18 = new String("文字列検索(lastIndexOf)-last");
 
strData18 = new String("文字列検索(lastIndexOf)-last");
  
document.write(".indexOf() : ",strData18, " ,検索位置 = ", strData18.lastIndexOf("last"), "</BR>");
+
document.write(".indexOf() : ",strData18, " ,検索位置 = ", strData18.lastIndexOf("last", strData18.length - 1), "</BR>");
 
</syntaxhighlight>
 
</syntaxhighlight>
  

2016年7月25日 (月) 00:00時点における版



個人用ツール
名前空間

変種
操作
案内
ツールボックス