OpenTAP 9.27
API Reference
|
A time span parser can parse a text input (which would typically be a user input) for timespan information like "1 hour 2 minutes" or "1 week 250ms" and sum them all up into a TimeSpan. Currently only English units are supported. More...
Static Public Member Functions | |
static TimeSpan | Parse (string input, NumberStyles numberParseStyles=NumberStyles.Any, CultureInfo numberParseCulture=null, bool acceptIndeterminate=false) |
Parses a string for TimeSpan Information like "1 week 2 days" or "2h12m3s". Currently only English units are accepted. Note that "month" is not a valid unit, since it does not correspond to a determined number of days and so is "year" because of leap years. However you can have both units parsed to hardwired values using the <cref name="acceptIndeterminate"> parameter. Note that Microseconds are accepted, but the .NET TimeSpan only resolves milliseconds. Thus only multiples of thousands of Microseconds will affect the result, e.g. "2000µs", when reformatted, will evaluate to "2ms" whereas "200µs" will simply return TimeSpan.Zero. More... | |
A time span parser can parse a text input (which would typically be a user input) for timespan information like "1 hour 2 minutes" or "1 week 250ms" and sum them all up into a TimeSpan. Currently only English units are supported.
|
inlinestatic |
Parses a string for TimeSpan Information like "1 week 2 days" or "2h12m3s". Currently only English units are accepted. Note that "month" is not a valid unit, since it does not correspond to a determined number of days and so is "year" because of leap years. However you can have both units parsed to hardwired values using the <cref name="acceptIndeterminate"> parameter. Note that Microseconds are accepted, but the .NET TimeSpan only resolves milliseconds. Thus only multiples of thousands of Microseconds will affect the result, e.g. "2000µs", when reformatted, will evaluate to "2ms" whereas "200µs" will simply return TimeSpan.Zero.
ArgumentException | Thrown when one or more arguments have unsupported or illegal values. |
FormatException | Thrown when a unit is unknown. |
input | The input string. |
numberParseStyles | The acceptable number styles. |
numberParseCulture | The culture for number parsing. If omitted, DefaultThreadCurrentCulture is chosen. |
acceptIndeterminate | true to accept months (as 30 days) and years (as 356 days). |
OpenTAP 9.27 API built Wed Nov 27 2024 13:14:46