Mid Function, Mid Statement

แƒแƒ‘แƒ แƒฃแƒœแƒ”แƒ‘แƒก แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒฃแƒšแƒ˜ แƒ’แƒแƒ›แƒแƒกแƒแƒฎแƒฃแƒšแƒ”แƒ‘แƒ˜แƒก แƒ›แƒ˜แƒ—แƒ˜แƒ—แƒ”แƒ‘แƒฃแƒš แƒœแƒแƒฌแƒ˜แƒšแƒก (Mid แƒคแƒฃแƒœแƒฅแƒชแƒ˜แƒ), แƒแƒœ แƒ”แƒ แƒ—แƒ˜ แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒฃแƒšแƒ˜ แƒ’แƒแƒ›แƒแƒกแƒแƒฎแƒฃแƒšแƒ”แƒ‘แƒ˜แƒก แƒœแƒแƒฌแƒ˜แƒšแƒก แƒฉแƒแƒแƒœแƒแƒชแƒ•แƒšแƒ”แƒ‘แƒก แƒ›แƒ”แƒแƒ แƒ˜แƒ— (Mid แƒ’แƒแƒœแƒชแƒฎแƒแƒ“แƒ”แƒ‘แƒ).

Syntax:


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

Return value:

แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒ˜ (แƒ›แƒฎแƒแƒšแƒแƒ“ แƒคแƒฃแƒœแƒฅแƒชแƒ˜แƒ˜แƒ—)

Parameters:

แƒขแƒ”แƒฅแƒกแƒขแƒ˜: แƒ—แƒฅแƒ•แƒ”แƒœแƒ—แƒ•แƒ˜แƒก แƒ แƒ”แƒ“แƒแƒฅแƒขแƒ˜แƒ แƒ”แƒ‘แƒ˜แƒกแƒ—แƒ•แƒ˜แƒก แƒกแƒแƒกแƒฃแƒ แƒ•แƒ”แƒšแƒ˜ แƒœแƒ”แƒ‘แƒ˜แƒกแƒ›แƒ˜แƒ”แƒ แƒ˜ แƒขแƒ”แƒฅแƒกแƒขแƒฃแƒ แƒ˜ แƒ’แƒแƒ›แƒแƒกแƒแƒฎแƒฃแƒšแƒ”แƒ‘แƒ.

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 แƒคแƒฃแƒœแƒฅแƒชแƒ˜แƒแƒจแƒ˜ แƒ’แƒแƒ›แƒแƒขแƒแƒ•แƒ”แƒ‘แƒฃแƒšแƒ˜แƒ, แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒ˜แƒก แƒ’แƒแƒ›แƒแƒกแƒแƒฎแƒฃแƒšแƒ”แƒ‘แƒแƒจแƒ˜ แƒงแƒ•แƒ”แƒšแƒ แƒแƒกแƒ-แƒœแƒ˜แƒจแƒแƒœแƒ˜ แƒ“แƒแƒ‘แƒ แƒฃแƒœแƒ“แƒ”แƒ‘แƒ แƒกแƒแƒฌแƒงแƒ˜แƒกแƒ˜แƒ“แƒแƒœ แƒกแƒแƒ‘แƒแƒšแƒแƒ แƒžแƒแƒ–แƒ˜แƒชแƒ˜แƒแƒ›แƒ“แƒ”.

แƒ—แƒฃ แƒกแƒ˜แƒ’แƒ แƒซแƒ˜แƒก แƒžแƒแƒ แƒแƒ›แƒ”แƒขแƒ แƒ˜ Mid แƒ“แƒ”แƒ‘แƒฃแƒšแƒ”แƒ‘แƒแƒจแƒ˜ แƒœแƒแƒ™แƒšแƒ”แƒ‘แƒ˜แƒ แƒฉแƒแƒกแƒแƒœแƒแƒชแƒ•แƒšแƒ”แƒ‘แƒ”แƒšแƒ˜ แƒขแƒ”แƒฅแƒกแƒขแƒ˜แƒก แƒกแƒ˜แƒ’แƒ แƒซแƒ”แƒ–แƒ”, แƒขแƒ”แƒฅแƒกแƒขแƒ˜ แƒจแƒ”แƒ›แƒชแƒ˜แƒ แƒ“แƒ”แƒ‘แƒ แƒ›แƒ˜แƒ—แƒ˜แƒ—แƒ”แƒ‘แƒฃแƒš แƒกแƒ˜แƒ’แƒ แƒซแƒ”แƒ›แƒ“แƒ”.

แƒขแƒ”แƒฅแƒกแƒขแƒ˜: แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒฃแƒšแƒ˜ แƒ’แƒแƒ›แƒแƒกแƒแƒฎแƒฃแƒšแƒ”แƒ‘แƒ˜แƒก แƒฉแƒแƒกแƒแƒœแƒแƒชแƒ•แƒšแƒ”แƒ‘แƒ”แƒšแƒ˜ แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒ˜.(Mid แƒ“แƒ”แƒ‘แƒฃแƒšแƒ”แƒ‘แƒ).

Error codes:

D'oh! You found a bug (text/sbasic/shared/00000003.xhp#err5 not found).

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!