وظيفة VBScript اليسرى
❮ استكمال مرجع VBScript
ترجع الدالة Left عددًا محددًا من الأحرف من الجانب الأيسر للسلسلة.
تلميح: استخدم الدالة Len للعثور على عدد الأحرف في سلسلة.
نصيحة: انظر أيضًا إلى الوظيفة الصحيحة.
بناء الجملة
Left(string,length)
Parameter | Description |
---|---|
string | Required. The string to return characters from |
length | Required. Specifies how many characters to return. If set to 0, an empty string ("") is returned. If set to greater than or equal to the length of the string, the entire string is returned |
أمثلة
مثال 1
<%
txt="This is a beautiful day!"
response.write(Left(txt,15))
%>
ناتج الكود أعلاه سيكون:
This is a beaut
مثال 2
أعد السلسلة بأكملها:
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Left(txt,x))
%>
ناتج الكود أعلاه سيكون:
This is a beautiful day!
❮ استكمال مرجع VBScript