Skip to main content

Get-a-String-in-the-Middle

Command Description

Get a string in the middle

Command Prototype

sRet = Mid(sText,iPos,iSize)

Parameter Description

ParameterRequiredTypeDefaultDescription
sTextTruestring""The string to be operated
iPosTruenumber1Get substring started from the position N and N >= 1. Return empty string if N > string length
iSizeTruenumber1Get N characters and N >= 1. If N is greater than the string length, it will return the entire string

return

sRet,The variable used to save the output of the command.

Demo

TracePrint("----------------------Get the intermediate string --------------------- ---") 
//-------------------------------------------------------------------------------
//[Remarks] Get the intermediate string.
//Input parameter 1:
// sText--A string to operate on.
//Input parameter 2:
// iPos--Intercept from the Nth character, N>=1, and is a positive integer, when (N = 1) means to intercept from the 1st character.
//Input parameter 3:
// iSize--Specify to intercept N characters, N>=1, and it is a positive integer.
//out parameters:
// sRet--The variable to which the output of the function call is saved.
//
//Command prototype: sRet=Mid(sText, iPos, iSize)
//-------------------------------------------------------------------------------
sRet = Mid ("UiBot", 3.1)
TracePrint (sRet)