Strings.RSet(String, Int32) 方法

定义

返回一个右对齐的字符串,该字符串包含调整为指定长度的指定字符串。

public:
 static System::String ^ RSet(System::String ^ Source, int Length);
public static string RSet(string? Source, int Length);
public static string RSet(string Source, int Length);
static member RSet : string * int -> string
Public Function RSet (Source As String, Length As Integer) As String

参数

Source
String

必填。 String 表达式。 字符串变量的名称。

Length
Int32

必填。 Integer 表达式。 返回的字符串的长度。

返回

一个右对齐的字符串,包含调整为指定长度的指定字符串。

示例

此示例演示函数 RSet 的使用。

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

注解

如果 Source 长度超过 LengthRSet 则返回的字符串中只放置最左边的 Source字符(最大长度)。 如果指定的字符串比指定的长度短,则会将空格添加到字符串的左端,以生成适当的长度。 如果指定的字符串长度超过指定的长度,则会将其缩短为指定的长度。

适用于

另请参阅