Chức năng bên phải của VBScript
❮ Toàn bộ tài liệu tham khảo VBScript
Hàm Right trả về một số ký tự được chỉ định từ phía bên phải của một chuỗi.
Mẹo: Sử dụng hàm Len để tìm số ký tự trong một chuỗi.
Mẹo: Cũng nhìn vào chức năng Trái.
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 |
Các 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!
Ví dụ 2
Trả lại 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!
❮ Toàn bộ tài liệu tham khảo VBScript