<< Prev        Next >>

ID : 282

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 String Type data.
Start position
Specify from which character it returns by Integer Type data.
Number of characters
Specify the number of characters to return by Integer Type data. This is an optional value. If this is omitted, all strings after the start position are returned.

Return value

Return String Type 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 : 282

<< Prev        Next >>