Mid

Return a mid-section from a string.

Syntax 
      Mid(string , start [, length]

Key
   string   The text string (or string expression).
 
   start    The start position of the substring

   length   The length of the substring i.e. number of characters to return

Examples

'Display a message:

strSample="Partnum45"
WScript.Echo Mid(strSample,8,2)
> 45

“I would rather wake up in the middle of nowhere than in any city on earth” - Steve Mcqueen

Related VBScript commands

Left - Extract a substring from a string
Right - Return the rightmost len characters of string
Equivalent in PowerShell: $result = $myvar.substring(2,3)


 
Copyright © 1999-2024 SS64.com
Some rights reserved