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

◆ AppendFormatted() [3/5]

bool System.MemoryExtensions.TryWriteInterpolatedStringHandler.AppendFormatted ( ReadOnlySpan< char > value,
int alignment = 0,
string? format = null )
inline

Definition at line 185 of file MemoryExtensions.cs.

186 {
187 bool flag = false;
188 if (alignment < 0)
189 {
190 flag = true;
192 }
193 int num = alignment - value.Length;
194 if (num <= 0)
195 {
196 return AppendFormatted(value);
197 }
199 {
200 if (flag)
201 {
202 value.CopyTo(_destination.Slice(_pos));
203 _pos += value.Length;
204 _destination.Slice(_pos, num).Fill(' ');
205 _pos += num;
206 }
207 else
208 {
209 _destination.Slice(_pos, num).Fill(' ');
210 _pos += num;
211 value.CopyTo(_destination.Slice(_pos));
212 _pos += value.Length;
213 }
214 return true;
215 }
216 return Fail();
217 }
Span< T > Slice(int start)
Definition Span.cs:271
int Length
Definition Span.cs:70

References System.MemoryExtensions.TryWriteInterpolatedStringHandler._destination, System.MemoryExtensions.TryWriteInterpolatedStringHandler._pos, System.MemoryExtensions.TryWriteInterpolatedStringHandler.AppendFormatted(), System.MemoryExtensions.TryWriteInterpolatedStringHandler.Fail(), System.Span< T >.Length, System.Span< T >.Slice(), and System.value.