Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseNum ¶
Returns a number which was parsed from the given string. Uses strconv.Atoi. If the number cannot be parsed, returns an error.
func ParseNumOrPanic ¶
Returns a number which was parsed from the given string or panics if it fails. Uses strconv.Atoi.
func ReadFileBlocks ¶
ReadFileLines reads the lines of the specified split on two newlines, that is in two blocks separated by two newlines and returns each block as a slice as part of another slice contains all the blocks. If the file does not exist or the scanner returns an error, it returns an error.
func ReadFileLines ¶
ReadFileLines reads the lines of the specified split on newlines and returns as a `[]string`. If the file does not exist or the scanner returns an error, it returns an error.
Types ¶
type StringStack ¶
type StringStack struct {
// contains filtered or unexported fields
}
A stack to store strings only. For a general stack, or other general data structure use other packages like https://github.com/zyedidia/generic
func NewPopulatedStringStack ¶
func NewPopulatedStringStack(values []string) *StringStack
Returns a new string stack initialized with the values provided. The values are pushed onto the stack from the starting of the values till the end.
func NewStringStack ¶
func NewStringStack() *StringStack
Returns a new initialized string stack. Push and Pop can work right away.
func (*StringStack) IsEmpty ¶
func (s *StringStack) IsEmpty() bool
Returns whether the stack is empty or not
func (*StringStack) Peek ¶
func (s *StringStack) Peek() (string, error)
Returns the top string from the stack but does not remove it. It returns an error if the stack is empty.
func (*StringStack) Pop ¶
func (s *StringStack) Pop() (string, error)
Remove the top string from the stack and return it. It returns an error if the stack is empty.