Mid Function, Mid Statement

აბრუნებს სტრინგული გამოსახულების მითითებულ ნაწილს (Mid ფუნქცია), ან ერთი სტრინგული გამოსახულების ნაწილს ჩაანაცვლებს მეორით (Mid განცხადება).

Syntax:


Mid (Text As String, Start As Long [, Length As Long])
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 ExampleMid_Function_and_Statement
  text = "This is the original Text"
func1:
  MsgBox Mid(text, 13, 8)   ' returns the word "original"
  MsgBox text               ' text is not modified
stmt1:
  Mid(text, 13, 8, "new")
  MsgBox text               ' returns "This is the new Text"
func2:
  MsgBox Mid(start:=10, string:="The quick brown fox ..") ' shows " brown fox .."
stmt2:
  Mid text, 9, 12, "a new Phrase"
  MsgBox text               ' returns "This is a new Phrase"
End Sub