Mid Function, Mid Statement

Mid ํ•จ์ˆ˜๋Š” ๋ฌธ์ž์—ด ์‹์˜ ์ง€์ •๋œ ์ผ๋ถ€๋ฅผ ๊ตฌํ•˜๋ฉฐ, Mid ๋ฌธ์€ ๋ฌธ์ž์—ด ์‹์˜ ์ง€์ •๋œ ์ผ๋ถ€๋ฅผ ๋‹ค๋ฅธ ๋ฌธ์ž์—ด๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

Syntax:


Mid (Text As String, Start As Integer [, Length As Integer]) or Mid (Text As String, Start As Integer , Length As Integer, Text As String)

Return value:

String (only by Function)

Parameters:

Text: ์ˆ˜์ •ํ•  ์ž„์˜์˜ ๋ฌธ์ž์—ด ์‹์ž…๋‹ˆ๋‹ค.

Start: Numeric expression that indicates the character position within the string where the string portion that you want to replace or to return begins. The minimum allowed value is 1. The maximum allowed value is 2,147,483,648.

Length: Numeric expression that returns the number of characters that you want to replace or return. The maximum allowed value is 2,147,483,648.

Mid ํ•จ์ˆ˜์˜ Length ๋งค๊ฐœ ๋ณ€์ˆ˜๋ฅผ ์ƒ๋žตํ•  ๊ฒฝ์šฐ ์‹œ์ž‘ ์œ„์น˜์—์„œ ๋ฌธ์ž์—ด์˜ ๋๊นŒ์ง€ ๋ฌธ์ž์—ด ์‹์˜ ๋ชจ๋“  ๋ฌธ์ž๊ฐ€ ๊ตฌํ•ด์ง‘๋‹ˆ๋‹ค.

Mid ๋ฌธ์˜ Length ๋งค๊ฐœ ๋ณ€์ˆ˜๊ฐ€ ๋ฐ”๊ฟ€ ํ…์ŠคํŠธ์˜ ๊ธธ์ด๋ณด๋‹ค ์ž‘์„ ๊ฒฝ์šฐ ํ…์ŠคํŠธ๋Š” ์ง€์ •ํ•œ ๊ธธ์ด๋กœ ์ค„์–ด๋“ญ๋‹ˆ๋‹ค.

Text: ๋ฌธ์ž์—ด ์‹์„ ๋ฐ”๊ฟ€ ๋ฌธ์ž์—ด์ž…๋‹ˆ๋‹ค(Mid ๋ฌธ).

Error codes:

5 ์ž˜๋ชป๋œ ํ”„๋กœ์‹œ์ € ํ˜ธ์ถœ์ž…๋‹ˆ๋‹ค.

Example:


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

Please support us!