Return a specified number of characters from a text string starting at a specified position.
text - required string with the characters to extract
start_num - required position of the first character in a string
num_chars - required number of characters to extract
The MIDB function returns a portion of a string, starting at the character specified by the second argument and n number of characters specified by the third argument. For example, this returns the fifth character from the string in A2, starting at the 1st character.
If the number of characters to return (the third argument) is greater than the length of the string, all characters, beginning with the character specified by the second argument, are returned. For example, this returns the 20th character from the string in A2, starting at the 7th character. Because the number of characters to return (20) is greater than the length of the string (10), all characters, beginning with the 7th, are returned. No empty characters (spaces) are added to the end.
The MIDB function can be used to return the last n characters from a string. For example, if A2 contains the string "Sourcetable", this returns the last 3 characters from the string in A2, starting at the 2nd to last character. This example returns the string "cel".
The MIDB function returns a specified number of characters from a text string, counting each character as one type of byte. It returns an empty text if the start_num is greater than the length of text.
The MIDB function returns a specific number of characters from a text string starting at a specified position, excluding the first character.
The start_num argument defines the number of characters that are returned.
If the start_num argument is greater than the length of the text, the MIDB function will return an empty string.
Frequently Asked Questions
What is MIDB?
MIDB is an acronym for the â€œMID function with Double-Byte Charactersâ€. It is a function intended for use with languages that use the double-byte character set.
How does the default language setting on a computer affect the return value of MIDB?
The default language setting on a computer affects the return value of MIDB because the function counts each double-byte character as 2 when DBCS editing is enabled in a language that supports it.
Which languages support DBCS?
DBCS is supported by languages including Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.
What arguments are required for MIDB?
The text argument, the start_num argument, and the num_chars argument are all required for MIDB.