Mid Function


Mid function returns specific number of characters starting from the specified position in a String.

SyntaxMid(String,Start,[Length])

String (Required) – String expression

Start (Required) – Specifies the starting position of the characters to be returned from String

Length (Optional) – Specifies the number of characters to be returned from String

If the number of characters to be returned is not specified, Mid function returns all characters of the String from the specified start position

Examples:

'Return 2 characters starting at position 1
MsgBoxMid("QTP Sreenu Blog",1,2) 'Output is "QT"
=======================================================
'Return all characters starting at position 5
MsgBoxMid("QTP Sreenu Blog",5) 'Output is "Sreenu Blog"

No comments:

Post a Comment