Fungsi Kiri VBScript
Referensi VBScript Lengkap
Fungsi Kiri mengembalikan sejumlah karakter tertentu dari sisi kiri string.
Tip: Gunakan fungsi Len untuk menemukan jumlah karakter dalam string.
Tip: Lihat juga fungsi Kanan.
Sintaksis
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 |
Contoh
Contoh 1
<%
txt="This is a beautiful day!"
response.write(Left(txt,15))
%>
Output dari kode di atas akan menjadi:
This is a beaut
Contoh 2
Kembalikan seluruh string:
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Left(txt,x))
%>
Output dari kode di atas akan menjadi:
This is a beautiful day!
Referensi VBScript Lengkap