functionstringToTimeBase
Find the corresponding element of the TimeBases enumeration for a given time base string
Extends from BusinessSimulation.Icons.Function (Icon for functions).
Information
This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.
The function will return the element of the enumeration Types.TimeBases that corresponds to a given unit of time given as a string. The string should be given in lower case letters and should be given either as a word or the unit symbol. If there is no match, the function will default to TimeBases.second.
Syntax
Functions.stringToTimeBase( timeBaseString ); // the string is to be given as lower case
Examples
stringToTimeBase( "month" ); // TimesBases.months
stringToTimeBase( "yrCal" ); // TimeBases.years
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | timeBaseString | String for a time base given in lower case |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| TimeBases | timeBase | Element in the enumeration corresponding to the string given |
Revisions
- As of v2.2 the strings "year", "years", "yrCal", "y" may be used to indicate
TimeBases.years.