Documentation ¶
Index ¶
- func Escape(dst, src []byte, idx int) int
- func EscapedLength(src []byte) int
- func IsAlphaNumeric(str string) bool
- func IsRuneAlphaNumeric(r rune) bool
- func NeedToEscape(bb []byte) bool
- func Quote(dst, src []byte, idx int) int
- func QuoteSimple(dst, src []byte, idx int) int
- func QuotedLength(src []byte) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Escape ¶
Escape copies byte slice src to dst at a given index, adding escaping any quote or control characters. It returns the index at which the copy finished.
NB: ensure that dst is large enough to store src, additional quotation runes, and any additional escape characters. as generated by Quote, to dst and returns the extended buffer.
func EscapedLength ¶
EscapedLength computes the length required for a byte slice to hold a quoted byte slice.
NB: essentially a dry-run of `Escape` that does not write characters, but instead counts total character counts for the destination byte slice.
func IsAlphaNumeric ¶ added in v0.8.0
IsAlphaNumeric returns true if the given string is alpha numeric.
NB: here this means that it contains only characters in [0-9A-Za-z])
func IsRuneAlphaNumeric ¶ added in v0.8.0
IsRuneAlphaNumeric returns true if the given rune is alpha numeric.
NB: here this means that it contains only characters in [0-9A-Za-z])
func NeedToEscape ¶
NeedToEscape returns true if the byte slice contains characters that will need to be escaped when quoting the slice.
func Quote ¶
Quote copies byte slice src to dst at a given index, adding quotation runes around the src slice and escaping any quote or control characters. It returns the index at which the copy finished.
NB: ensure that dst is large enough to store src, additional quotation runes, and any additional escape characters. as generated by Quote, to dst and returns the extended buffer.
NB: based on stconv.Quote method, but instead uses indexed insertion into a predefined buffer.
func QuoteSimple ¶
QuoteSimple copies byte slice src to dst at a given index, adding quotation runes around the src slice, but does not escape any characters. It returns the index at which the copy finished.
NB: ensure that dst is large enough to store src and two other characters.
func QuotedLength ¶
QuotedLength computes the length required for a byte slice to hold a quoted byte slice.
NB: essentially a dry-run of `Quote` that does not write characters, but instead counts total character counts for the destination byte slice.
Types ¶
This section is empty.