Função esquerda do VBScript
❮ Referência completa do VBScript
A função Left retorna um número especificado de caracteres do lado esquerdo de uma string.
Dica: Use a função Len para encontrar o número de caracteres em uma string.
Dica: Veja também a função Right.
Sintaxe
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 |
Exemplos
Exemplo 1
<%
txt="This is a beautiful day!"
response.write(Left(txt,15))
%>
A saída do código acima será:
This is a beaut
Exemplo 2
Retorna a string inteira:
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Left(txt,x))
%>
A saída do código acima será:
This is a beautiful day!
❮ Referência completa do VBScript