Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceCharIndex ¶
Will replace all characters at the given indices with the new strings. Returns a new string.
Indices are all the character indices with which to replace with the new string. Each occurrence will be replaced by the string new[occCount % len(new)]. Where occCount is the current count of the indices that have been replaced.
func ReplaceCharIndexRange ¶
Similar to ReplaceCharIndex but takes multiple index ranges in the form of [start, end].
The length of new strings must be less than or equal to the length of the indices slice. The length of indices must also be greater than 0. If any of these conditions are not met the old string shall be returned.
func StripWhitespace ¶
Given a string, will strip all whitespace from it and return a new string without any whitespace.
Types ¶
type StringHeap ¶
type StringHeap []string
A priority queue which sorts strings lexicographically.
func (StringHeap) Less ¶
func (spq StringHeap) Less(i, j int) bool
Compares two string elements in the StringHeap.
Uses strings.Compare internally.
func (*StringHeap) Push ¶
func (spq *StringHeap) Push(x interface{})
Pushes the given interface{} to the heap.
Will panic if given interface{} is not a string.
func (StringHeap) Swap ¶
func (spq StringHeap) Swap(i, j int)
Swaps the two elements indicated via the given indices.