VBScript Right 函數(shù)
定義和用法
Right 函數(shù)可從字符串右側(cè)返回指定數(shù)目的字符。
提示:請使用Len 函數(shù)來確定字符串中的字符數(shù)目。
提示:請參閱 Left 函數(shù)。
語法
Right(string,length)
| 參數(shù) | 描述 |
|---|---|
| string | 必需的。從其中返回字符的字符串。 |
| length | 必需的。規(guī)定返回多少字符。如果設(shè)置為 0,則返回空字符串 ("")。如果設(shè)置為大于或等于字符串的長度,則返回整個的字符串。 |
實例
例子 1
dim txt txt="This is a beautiful day!" document.write(Right(txt,11))
輸出:
utiful day!
例子 2
dim txt txt="This is a beautiful day!" document.write(Right(txt,100))
輸出:
This is a beautiful day!
例子 3
dim txt,x txt="This is a beautiful day!" x=Len(txt) document.write(Right(txt,x))
輸出:
This is a beautiful day!