「VBScript入門」Replace 関数で一部文字列を置換するサンプル

2020年12月17日

説明
Replace(strString, strFind, strRep [, posStart, posCnt, posCmp])
strString:置換元文字列
strFind:検索文字列
strRep:置換先文字列
posStart:開始位置
posCnt:文字列数
使用例

Dim strTarget1
Dim strTarget2
strTarget = Replace("http://www.arkgame.com", "http://", "study skill in ")
WScript.Echo "result1: "& strTarget 

strTarget2 = Replace("wwwwww.arkgame.com", "w", "s",1,-1,1)
WScript.Echo "result2: "& strTarget2 

実行結果
result1:study skill in www.arkgame.com
result2:sssss.arkgame.com

VBScript

Posted by arkgame