VBS TUTORIAL: function-mid function _vbs

Source: Internet
Author: User

Mid function

Returns a specified number of characters from a string.

Mid(string, start[, length])

Parameters

String

A string expression from which to return a character. If string contains null, nullis returned.

Start

The start position of the extracted character part in string . If start exceeds the number of characters in string ,Mid returns a 0 length string ("").

Length

The number of characters to return. If omitted or length exceeds the number of characters in the text, including the character at start , all characters in the string ending from start to String are returned.

Description

To determine the number of characters in a string , you can use the Len function.

The following example uses the Mid function to return six characters starting from the fourth character in a string:

Mid("VBScript is fun!", 4, 6) 'MyVar  contains  "Script" .

Attention The MidB function is used in conjunction with the byte data contained in the string. The parameter is not the specified number of characters, but the number of bytes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.