Share via


RSet 函式

更新:2007 年 11 月

傳回包含調整成指定長度的指定字串的靠右對齊字串。

 Public Shared Function RSet( _        ByVal Source As String, _        ByVal Length As Integer _ ) As String

參數

  • Source
    必要項。String 運算式。要調整的字串。

  • Length
    必要項。Integer 運算式。傳回的字串長度。

備註

如果 Source 的長度比 Length 長,則 RSet 只會傳回最左邊的字元,最長可達 Length 的長度。如果 Source 的長度比 Length 短,則 RSet 會在字串的最左邊加上空格,以達到適合的長度。

範例

這個範例將示範 RSet 函式的用法。

Dim TestString As String = "Right"
' Returns "      Right"
Dim rString As String = RSet(TestString, 11)

需求

命名空間 (Namespace)︰Microsoft.VisualBasic

模組:Strings

組件 (Assembly):Visual Basic Runtime Library (在 Microsoft.VisualBasic.dll 中)

請參閱

概念

有效率地使用資料型別

參考

字串操作摘要

資料型別摘要 (Visual Basic)

LSet 函式