시작하기 위해 회사 또는 학교 계정을 입력하세요.
Extracts the left, middle, or right portion of a string of text.
The Left, Mid, and Right functions return a portion of a string.
If you specify a single string as an argument, the function returns the portion that you requested of the string. If you specify a single-column table that contains strings, the function returns a single-column table of the portions that you requested of those strings. If you specify a multi-column table, you can shape it into a single-column table, as working with tables describes.
If the starting position is negative or beyond the end of the string, Mid returns blank. You can check the length of a string by using the Len function. If you request more characters than the string contains, the function returns as many characters as possible.
Left( String, NumberOfCharacters )
Mid( String, StartingPosition, NumberOfCharacters )
Right( String, NumberOfCharacters )
Left( SingleColumnTable, NumberOfCharacters )
Mid( SingleColumnTable, StartingPosition, NumberOfCharacters )
Right( SingleColumnTable, NumberOfCharacters )
The examples in this section use a text-input control as their data source. The control is named Author and contains the string "E. E. Cummings".
|Left( Author.Text, 5 )||Extracts up to five characters from the start of the string.||"E. E."|
|Mid( Author.Text, 7, 4 )||Extracts up to four characters, starting with the seventh character, from the string.||"Cumm"|
|Right( Author.Text, 5 )||Extracts up to five characters from the end of the string.||"mings"|
Each example in this section extracts strings from the Address column of this data source, named People, and returns a single-column table that contains the results:
|Left( ShowColumns( People, "Address" ), 8 )||Extracts the first eight characters of each string.|
|Mid( ShowColumns( People, "Address" ), 5, 7 )||Extracts the middle seven characters of each string, starting with the fifth character.|
|Right( ShowColumns( People, "Address" ), 7 )||Extracts the last seven characters of each string.|
Set the Text property of the lower label in the gallery to this function:
The label shows the last three characters of each product name.