「VBScript入門」Mid関数を使うサンプル

2020年12月17日

説明
Mid(strString, posStart [,posCnt])
文字列の左端から指定された位置から文字数分の文字列を返します。
posStart
引数string の先頭の位置を1指定
posCnt
文字数を指定
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Dim strRes
Dim strPa
strPa = "Studyskillinarkgame.com"
strRes = Mid(strPa, 4,6)
WScript.Echo "result1: " & strRes
strRes = Left(strPa, 4)
WScript.Echo "result2: "& strRes
Dim strRes Dim strPa strPa = "Studyskillinarkgame.com" strRes = Mid(strPa, 4,6) WScript.Echo "result1: " & strRes strRes = Left(strPa, 4) WScript.Echo "result2: "& strRes
Dim strRes
Dim strPa
strPa = "Studyskillinarkgame.com"
strRes = Mid(strPa, 4,6)                 
WScript.Echo "result1: " & strRes   
strRes = Left(strPa, 4)    
WScript.Echo "result2: "& strRes

実行結果
result1:dyskil
result2:Stud

VBScript

Posted by arkgame