Chức năng bên phải VBScript
❮ Tham khảo VBScript hoàn chỉnh
Hàm Right trả về một số ký tự được chỉ định từ phía bên phải của chuỗi.
Mẹo: Sử dụng hàm Len để tìm số ký tự trong một chuỗi.
Mẹo: Ngoài ra, hãy xem chức năng Left.
Cú pháp
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 |
Ví dụ
ví dụ 1
<%
txt="This is a beautiful day!"
response.write(Right(txt,10))
%>
Đầu ra của đoạn mã trên sẽ là:
tiful day!
Hiển thị ví dụ »Ví dụ 2
Trả về toàn bộ chuỗi:
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Right(txt,x))
%>
Đầu ra của đoạn mã trên sẽ là:
This is a beautiful day!
Hiển thị ví dụ »❮ Tham khảo VBScript hoàn chỉnh