VBScript Right 函數(shù)

2022-08-19 09:58 更新

VBScript Right 函數(shù)返回字符串最右邊的指定數(shù)量的字符。


VBScript 參考手冊完整的 VBScript 參考手冊

Right 函數(shù)從字符串的右側(cè)返回指定數(shù)量的字符。

提示:請使用 Len 函數(shù)來確定字符串中的字符數(shù)量。

提示:請參閱 Left 函數(shù)。

語法

Right(string,length)

參數(shù) 描述
string 必需。從其中返回字符的字符串。
length 必需。規(guī)定需返回多少字符。如果設(shè)置為 0,則返回空字符串("")。如果設(shè)置為大于或等于字符串的長度,則返回整個字符串。

實(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

返回整個字符串:

<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 參考手冊完整的 VBScript 參考手冊
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號