Левая функция 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