YouTip LogoYouTip

Func Mid

# VBScript Mid Function * * Complete VBScript Reference Manual](#) * * * The Mid function returns a specified number of characters from a string. **Tip:** Use the Len function to determine the number of characters in a string. ### Syntax Mid(string,start[,length]) | Parameter | Description | | :--- | :--- | | string | Required. A string expression from which characters are returned. | | start | Required. Specifies the starting position. If set to a value greater than the number of characters in the string, an empty string ("") is returned. | | length | Optional. The number of characters to return. | ## Examples ## Example 1 Return 1 character, starting at position 1: txt="This is a beautiful day!" document.write(Mid(txt,1,1)) Output of the above example: T [Try it yourself Β»](#) ## Example 2 Return 15 characters, starting at position 1: txt="This is a beautiful day!" document.write(Mid(txt,1,15)) Output of the above example: This is a beaut [Try it yourself Β»](#) ## Example 3 Return all characters, starting at position 1: txt="This is a beautiful day!" document.write(Mid(txt,1)) Output of the above example: This is a beautiful day! [Try it yourself Β»](#) ## Example 4 Return all characters, starting at position 12: txt="This is a beautiful day!" document.write(Mid(txt,12)) Output of the above example: eautiful day! [Try it yourself Β»](#) * * Complete VBScript Reference Manual](#)
← Func ReplaceFunc Trim β†’