Fonction droite VBScript
❮ Référence complète de VBScript
La fonction Right renvoie un nombre spécifié de caractères à partir du côté droit d'une chaîne.
Astuce : Utilisez la fonction Len pour trouver le nombre de caractères dans une chaîne.
Astuce : Regardez également la fonction Gauche.
Syntaxe
Right(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 |
Exemples
Exemple 1
<%
txt="This is a beautiful day!"
response.write(Right(txt,10))
%>
La sortie du code ci-dessus sera :
tiful day!
Exemple 2
Renvoie la chaîne entière :
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Right(txt,x))
%>
La sortie du code ci-dessus sera :
This is a beautiful day!
❮ Référence complète de VBScript