PadRight 메서드 (Int32, Char)
콘텐츠의 테이블 축소
콘텐츠의 테이블 확장
이 문서는 기계 번역을 이용하여 번역되었습니다. 문서를 영문으로 보려면 영문 확인란을 선택하세요. 마우스 포인터를 텍스트 위로 이동시켜 팝업 창에서 영문 텍스트를 표시할 수도 있습니다.
번역
영문

String.PadRight 메서드 (Int32, Char)

 

Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length.

네임스페이스:   System
어셈블리:  mscorlib.dll의 mscorlib

public string PadRight(
	int totalWidth,
	char paddingChar
)

매개 변수

totalWidth
Type: System.Int32

The number of characters in the resulting string, equal to the number of original characters plus any additional padding characters.

paddingChar
Type: System.Char

A Unicode padding character.

반환 값

Type: System.String

A new string that is equivalent to this instance, but left-aligned and padded on the right with as many paddingChar characters as needed to create a length of totalWidth. However, if totalWidth is less than the length of this instance, the method returns a reference to the existing instance. If totalWidthis equal to the length of this instance, the method returns a new string that is identical to this instance.

Exception Condition
ArgumentOutOfRangeException

totalWidth is less than zero.

The M:System.String.PadRight(System.Int32,System.Char) method pads the end of the returned string. This means that, when used with right-to-left languages, it pads the left portion of the string.

System_CAPS_note참고

If the M:System.String.PadRight(System.Int32) method pads the current instance with whitespace characters, this method does not modify the value of the current instance. Instead, it returns a new string that is padded with trailing paddingChar characters so that its total length is totalWidth characters.

The following example demonstrates the M:System.String.PadRight(System.Int32) method.

string str = "forty-two";
char pad = '.';

Console.WriteLine(str.PadRight(15, pad));    // Displays "forty-two......".
Console.WriteLine(str.PadRight(2,  pad));    // Displays "forty-two".

Universal Windows Platform
4.5 이후에 사용 가능
.NET Framework
1.1 이후에 사용 가능
Portable Class Library
portable .NET platforms에서 지원 portable .NET platforms
Silverlight
2.0 이후에 사용 가능
Windows Phone Silverlight
7.0 이후에 사용 가능
Windows Phone
8.1 이후에 사용 가능
맨 위로 이동
표시:
© 2016 Microsoft