VBScript Right 函數(shù)
完整的 VBScript 參考手冊(cè)
Right 函數(shù)從字符串的右側(cè)返回指定數(shù)量的字符。
提示:請(qǐng)使用 Len 函數(shù)來(lái)確定字符串中的字符數(shù)量。
提示:請(qǐng)參閱 Left 函數(shù)。
語(yǔ)法
參數(shù) | 描述 |
string | 必需。從其中返回字符的字符串。 |
length | 必需。規(guī)定需返回多少字符。如果設(shè)置為 0,則返回空字符串("")。如果設(shè)置為大于或等于字符串的長(zhǎng)度,則返回整個(gè)字符串。 |
實(shí)例
實(shí)例 1
<script type="text/vbscript">
txt="This is a beautiful day!"
document.write(Right(txt,10))
</script>
以上實(shí)例輸出結(jié)果:
tiful day!
嘗試一下 ? 實(shí)例 2
返回整個(gè)字符串:
<script type="text/vbscript">
txt="This is a beautiful day!"
x=Len(txt)
document.write(Right(txt,x))
</script>
以上實(shí)例輸出結(jié)果:
This is a beautiful day!
嘗試一下 ?
完整的 VBScript 參考手冊(cè)