Lotus Symphony 1.2
|
傳回字串表示式的指定部份 (Mid 函數),或用另一字串取代字串表示式的指定部份 (Mid 陳述式)。
Mid(Text As String, Start As Integer[, Length As Integer]) 或 Mid(Text As String, Start As Integer , Length As Integer, Text As String)
Text:要修改的任意字串表示式。
Start:Integer 表示式,指出字串中想要取代或傳回的字串部份之字元位置。
Length:Integer 表示式,傳回要取代或傳回的字元數目。
如果不指定 Mid 函數中的 Length 參數,則會傳回字串表示式的所有字元 (從開始位置到字串結尾)。
如果 Mid 陳述式中的 Length 參數小於要取代文字的長度,則文字會縮短到指定的長度。
Text:取代字串表示式的字串 (Mid 陳述式)。
Sub ExampleUSDate
Dim sInput As String
Dim sUS_date As String
sInput = InputBox("Please input a date in the international format 'YYYY-MM-DD'")
sUS_date = Mid(sInput, 6, 2)
sUS_date = sUS_date & "/"
sUS_date = sUS_date & Right(sInput, 2)
sUS_date = sUS_date & "/"
sUS_date = sUS_date & Left(sInput, 4)
MsgBox sUS_date
End Sub