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

◆ Format()

static string System.Globalization.TimeSpanFormat.Format ( TimeSpan value,
string format,
IFormatProvider formatProvider )
inlinestaticpackage

Definition at line 184 of file TimeSpanFormat.cs.

185 {
186 if (string.IsNullOrEmpty(format))
187 {
188 return FormatC(value);
189 }
190 if (format.Length == 1)
191 {
192 char c = format[0];
193 if (c == 'c' || (c | 0x20) == 116)
194 {
195 return FormatC(value);
196 }
197 if ((c | 0x20) == 103)
198 {
199 return FormatG(value, DateTimeFormatInfo.GetInstance(formatProvider), (c == 'G') ? StandardFormat.G : StandardFormat.g);
200 }
201 throw new FormatException(SR.Format_InvalidString);
202 }
203 return StringBuilderCache.GetStringAndRelease(FormatCustomized(value, format, DateTimeFormatInfo.GetInstance(formatProvider)));
204 }
static string FormatG(TimeSpan value, DateTimeFormatInfo dtfi, StandardFormat format)
static StringBuilder FormatCustomized(TimeSpan value, ReadOnlySpan< char > format, DateTimeFormatInfo dtfi, StringBuilder result=null)
static string FormatC(TimeSpan value)
static string GetStringAndRelease(StringBuilder sb)

References System.format, System.SR.Format_InvalidString, System.Globalization.TimeSpanFormat.FormatC(), System.Globalization.TimeSpanFormat.FormatCustomized(), System.Globalization.TimeSpanFormat.FormatG(), System.Text.StringBuilderCache.GetStringAndRelease(), and System.value.

Referenced by System.TimeSpan.ToString(), and System.TimeSpan.ToString().