Lewa funkcja VBScript
❮ Pełne odniesienie do VBScript
Funkcja Left zwraca określoną liczbę znaków z lewej strony ciągu.
Porada: Użyj funkcji Len, aby znaleźć liczbę znaków w ciągu.
Wskazówka: spójrz także na funkcję Right.
Składnia
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 |
Przykłady
Przykład 1
<%
txt="This is a beautiful day!"
response.write(Left(txt,15))
%>
Wynikiem powyższego kodu będzie:
This is a beaut
Przykład 2
Zwróć cały ciąg:
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Left(txt,x))
%>
Wynikiem powyższego kodu będzie:
This is a beautiful day!
❮ Pełne odniesienie do VBScript