Documentation ¶
Overview ¶
Package cistring implements a case-insensitive string type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CIString ¶
type CIString struct {
// contains filtered or unexported fields
}
CIString is an immutable case-insensitive string. It precomputes and stores the lower case version of the string internally. This increases the initial memory cost of the object but saves the CPU (and memory) cost of lowercasing as needed. This should generally trade off favorably because there are many situations where comparisons are performed in a loop against the same object.
func (CIString) Equal ¶
Equal performs a case-insensitive compare. For comparing in a loop, it's beneficial to build a CIString outside the loop and using it to compare with other CIString variables inside the loop.
func (CIString) EqualString ¶
EqualString performs a case-insensitive compare with str. If the input is already lower-cased, it's more efficient to check if s.Lowered()==in.
func (CIString) Lowered ¶
Lowered returns the lower-case value of the string. This function should generally be used only for optimizing comparisons.
func (CIString) MarshalJSON ¶
MarshalJSON marshals into JSON.
func (*CIString) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.