Mid is a string function in Visual Basic and Microsoft Excel. Its function is to intercept a specified number of characters from a string.
The three parameters of this function are equivalent to each other in VB and Excel, but the Length parameter in VB can be omitted, while the num_chars parameter in Excel cannot be omitted.
When the Start (start_num) parameter is less than 1, the function returns an error;
When the Start parameter value is greater than the String (text) parameter length, an empty string is returned;
If the length of the interception from the Start parameter exceeds the end of the string, or the Length parameter is omitted, all characters from the Start parameter position to the end of the string will be returned.
Grammar
##VB in
Mid(String As Variant, Start As Long, [Length As Variant]) As Variant Mid$(String As String, Start As Long, [Length As Variant]) As String
Excel
MID(text, start_num, num_chars)
The above is the detailed content of What is the function of mid?. For more information, please follow other related articles on the PHP Chinese website!