<< 向前        下一页 >>

ID : 9155

Mid

Function

To return a string of the specified number of characters at the specified position from the string.

Syntax

Mid(string, start position[ , number of characters])

Guaranteed entry

String
Designate 字符串型 data.
Start position
Specify from which character it returns by 整数型 data.
Number of characters
Specify the number of characters to return by 整数型 data. This is an optional value. If this is omitted, all strings after the start position are returned.

Return value

Return 字符串型 data.

Description

A string of the specified number of characters at the specified position from the string is returned.

Related Terms

Asc, Chr, SprintF, Left, Len, Right, Val, InStr, Bin

Attention

-

Example

'!TITLE "Acquiring A String of Specified Number of Characters at Specified Position from A String"
' Acquire 3 characters from the second character from the left end of a string "abcdefg"
Sub Sample_Mid

  Dim aaa As String

  ' Assign 3 characters from the second character of a string "abcdefg" to aaa
  aaa = Mid( "abcdefg", 2, 3 )

  ' Display "bcd" on the message output window
  PrintDbg aaa

End Sub

ID : 9155

<< 向前        下一页 >>