Funzione sinistra VBScript
❮ Riferimento completo di VBScript
La funzione Left restituisce un numero specificato di caratteri dal lato sinistro di una stringa.
Suggerimento: utilizzare la funzione Len per trovare il numero di caratteri in una stringa.
Suggerimento: guarda anche la funzione Right.
Sintassi
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 |
Esempi
Esempio 1
<%
txt="This is a beautiful day!"
response.write(Left(txt,15))
%>
L'output del codice sopra sarà:
This is a beaut
Esempio 2
Restituisce l'intera stringa:
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Left(txt,x))
%>
L'output del codice sopra sarà:
This is a beautiful day!
❮ Riferimento completo di VBScript