ฟังก์ชันด้านขวา ของ VBScript
❮ การอ้างอิง VBScript ที่สมบูรณ์
ฟังก์ชัน Right ส่งกลับจำนวนอักขระที่ระบุจากด้านขวาของสตริง
เคล็ดลับ:ใช้ฟังก์ชัน Len เพื่อค้นหาจำนวนอักขระในสตริง
เคล็ดลับ:ดูฟังก์ชันด้านซ้ายด้วย
ไวยากรณ์
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 |
ตัวอย่าง
ตัวอย่าง 1
<%
txt="This is a beautiful day!"
response.write(Right(txt,10))
%>
ผลลัพธ์ของโค้ดด้านบนจะเป็น:
tiful day!
ตัวอย่าง 2
ส่งคืนสตริงทั้งหมด:
<%
txt="This is a beautiful day!"
x=Len(txt)
response.write(Right(txt,x))
%>
ผลลัพธ์ของโค้ดด้านบนจะเป็น:
This is a beautiful day!
❮ การอ้างอิง VBScript ที่สมบูรณ์