Mid Function, Mid Statement

একটি স্ট্রিং এক্সপ্রেশনের উল্লেখিত অংশ প্রদান করে থাকে (মধ্যবর্তী ফাংশন), অথবা অন্য একটি স্ট্রিং এর মাধ্যমে স্ট্রিংটির অংশ প্রতিস্থাপন করে থাকে (মধ্যবর্তী স্টেটমেন্ট )।

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:

String (only by Function)

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.

যদি মধ্যবর্তী ফাংশন এর দৈর্ঘ্য প্যারামিটার বাদ দেয়া হয় তাহলে ষ্ট্রিং এক্সপ্রেশনর শুরুর অবস্থান থেকে ষ্ট্রিং এর শেষ পর্যন্ত সব অক্ষর প্রদান করা হয়।

আপনি যে পাঠ্যটি প্রতিস্থাপন করতে চান তার দৈর্ঘ্য যদি মধ্যবর্তী স্টেটমেন্ট এর দৈর্ঘ্য প্যারামিটার চেয়ে বড় হয় তাহলে পাঠ্যটি উল্লেখিত দৈর্ঘ্যে হ্রাস পায়।

পাঠ্য: স্ট্রিং এক্সপ্রেশন প্রতিস্থাপন করতে স্ট্রিং ( মধ্যবর্তী স্টেটমেন্ট)।

Error codes:

5 Invalid procedure call

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