Fungsi Kanan VBScript


Referensi VBScript Lengkap

Fungsi Kanan mengembalikan sejumlah karakter tertentu dari sisi kanan string.

Tip: Gunakan fungsi Len untuk menemukan jumlah karakter dalam string.

Tip: Lihat juga fungsi Kiri.

Sintaksis

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

Contoh

Contoh 1

<%

txt="This is a beautiful day!"
response.write(Right(txt,10))

%>

Output dari kode di atas akan menjadi:

tiful day!

Contoh 2

Kembalikan seluruh string:

<%

txt="This is a beautiful day!"
x=Len(txt)
response.write(Right(txt,x))

%>

Output dari kode di atas akan menjadi:

This is a beautiful day!

Referensi VBScript Lengkap