Documentation ¶
Overview ¶
Package must simplifies writing advent-of-code scripts by providing methods that cause fatal errors instead of returning them.
Index ¶
- func Atoi(s string) int
- func ParseBool(str string) bool
- func ParseComplex(s string, bitSize int) complex128
- func ParseDuration(s string) time.Duration
- func ParseFloat(s string, bitSize int) float64
- func ParseInt(s string, base, bitSize int) int
- func ParseTime(layout, value string) time.Time
- func ParseTimeInLocation(layout, value string, loc *time.Location) time.Time
- func ParseUint(s string, base int, bitSize int) uint64
- func ReadFile(filename string) string
- func ReadFileLines(filename string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseComplex ¶
func ParseComplex(s string, bitSize int) complex128
ParseComplex parses a complex number with the given bitSize. It dies if there is an error.
func ParseDuration ¶
ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
func ParseFloat ¶
ParseFloat parses a complex number with the given bitSize. It dies if there is an error.
func ParseInt ¶
ParseInt parses an integer with the given base and bitSize. It dies if there is an error.
func ParseTime ¶ added in v0.0.6
ParseTime parses a formatted string and returns the time value it represents. It dies if there is an error.
func ParseTimeInLocation ¶ added in v0.0.6
ParseTimeInLocation is like Parse but differs in two important ways. First, in the absence of time zone information, Parse interprets a time as UTC; ParseInLocation interprets the time as in the given location. Second, when given a zone offset or abbreviation, Parse tries to match it against the Local location; ParseInLocation uses the given location.
func ParseUint ¶
ParseUint parses an unsigned integer with the given base and bitSize. It dies if there is an error.
func ReadFile ¶
ReadFile reads a file or causes a fatal error. It also returns a trimmed string instead of a byte slice.
func ReadFileLines ¶
ReadFileLines reads a file and returns a slice of lines.
Types ¶
This section is empty.