Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ PadLeft() [2/2]

string System.String.PadLeft ( int totalWidth,
char paddingChar )
inline

Definition at line 2244 of file String.cs.

2245 {
2246 if (totalWidth < 0)
2247 {
2248 throw new ArgumentOutOfRangeException("totalWidth", SR.ArgumentOutOfRange_NeedNonNegNum);
2249 }
2250 int length = Length;
2251 int num = totalWidth - length;
2252 if (num <= 0)
2253 {
2254 return this;
2255 }
2256 string text = FastAllocateString(totalWidth);
2257 new Span<char>(ref text._firstChar, num).Fill(paddingChar);
2258 Buffer.Memmove(ref Unsafe.Add(ref text._firstChar, num), ref _firstChar, (nuint)length);
2259 return text;
2260 }
char _firstChar
Definition String.cs:35
static string FastAllocateString(int length)

References System.String._firstChar, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.String.FastAllocateString(), System.length, System.String.Length, System.Buffer.Memmove(), and System.text.