वीबीस्क्रिप्ट मिड फंक्शन
❮ पूर्ण वीबीस्क्रिप्ट संदर्भ
मिड फ़ंक्शन एक स्ट्रिंग से वर्णों की एक निर्दिष्ट संख्या देता है।
युक्ति: स्ट्रिंग में वर्णों की संख्या निर्धारित करने के लिए लेन फ़ंक्शन का उपयोग करें।
वाक्य - विन्यास
Mid(string,start[,length])
Parameter | Description |
---|---|
string | Required. The string expression from which characters are returned |
start | Required. Specifies the starting position. If set to greater than the number of characters in string, it returns an empty string ("") |
length | Optional. The number of characters to return |
उदाहरण
उदाहरण 1
1 वर्ण लौटाएं, स्थिति 1 से शुरू करें:
<%
txt="This is a beautiful day!"
response.write(Mid(txt,1,1))
%>
उपरोक्त कोड का आउटपुट होगा:
T
उदाहरण 2
स्थिति 1 से शुरू करते हुए, 15 वर्ण लौटाएं:
<%
txt="This is a beautiful day!"
response.write(Mid(txt,1,15))
%>
उपरोक्त कोड का आउटपुट होगा:
This is a beaut
उदाहरण 3
स्थिति 1 से शुरू करते हुए, सभी वर्ण लौटाएं:
<%
txt="This is a beautiful day!"
response.write(Mid(txt,1))
%>
उपरोक्त कोड का आउटपुट होगा:
This is a beautiful day!
उदाहरण 4
स्थिति 12 से शुरू होने वाले सभी वर्णों को वापस करें:
<%
txt="This is a beautiful day!"
response.write(Mid(txt,12))
%>
उपरोक्त कोड का आउटपुट होगा:
eautiful day!
❮ पूर्ण वीबीस्क्रिप्ट संदर्भ