package parse
import "github.com/tdewolff/parse"
Package parse contains a collection of parsers for various formats in its subpackages.
Index ¶
- Variables
- func Copy(src []byte) (dst []byte)
- func DataURI(dataURI []byte) ([]byte, []byte, error)
- func Dimension(b []byte) (int, int)
- func Equal(s, target []byte) bool
- func EqualFold(s, targetLower []byte) bool
- func Float(b []byte) (float64, bool)
- func Int(b []byte) (int64, bool)
- func IsAllWhitespace(b []byte) bool
- func IsWhitespace(c byte) bool
- func Number(b []byte) int
- func QuoteEntity(b []byte) (quote byte, n int)
- func ReplaceMultipleWhitespace(b []byte) []byte
- func ToLower(src []byte) []byte
- func Trim(b []byte, f func(byte) bool) []byte
Variables ¶
Returned by DataURI when the byte slice does not start with 'data:' or is too short.
Functions ¶
func Copy ¶
Copy returns a copy of the given byte slice.
func DataURI ¶
DataURI parses the given data URI and returns the mediatype, data and ok.
func Dimension ¶
Dimension parses a byte-slice and returns the length of the number and its unit.
func Equal ¶
Equal returns true when s matches the target.
func EqualFold ¶
EqualFold returns true when s matches case-insensitively the targetLower (which must be lowercase).
func Float ¶
Float parses a byte-slice and returns the float it represents. If an invalid character is encountered, it will stop there.
func Int ¶
Int parses a byte-slice and returns the integer it represents. If an invalid character is encountered, it will stop there.
func IsAllWhitespace ¶
IsAllWhitespace returns true when the entire byte slice consists of space, \n, \r, \t, \f.
func IsWhitespace ¶
IsWhitespace returns true for space, \n, \r, \t, \f.
func Number ¶
Number returns the number of bytes that parse as a number of the regex format (+|-)?([0-9]+(\.[0-9]+)?|\.[0-9]+)((e|E)(+|-)?[0-9]+)?.
func QuoteEntity ¶
QuoteEntity parses the given byte slice and returns the quote that got matched (' or ") and its entity length.
func ReplaceMultipleWhitespace ¶
ReplaceMultipleWhitespace replaces character series of space, \n, \t, \f, \r into a single space.
func ToLower ¶
ToLower converts all characters in the byte slice from A-Z to a-z.
func Trim ¶
Trim removes any character from the start and end for which the function returns true.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
css | Package css is a CSS3 lexer and parser following the specifications at http://www.w3.org/TR/css-syntax-3/. |
html | Package html is an HTML5 lexer following the specifications at http://www.w3.org/TR/html5/syntax.html. |
js | Package js is an ECMAScript5.1 lexer following the specifications at http://www.ecma-international.org/ecma-262/5.1/. |
json | Package json is a JSON parser following the specifications at http://json.org/. |
svg | |
xml | Package xml is an XML1.0 lexer following the specifications at http://www.w3.org/TR/xml/. |
- Version
- v1.1.0 (latest)
- Published
- Nov 2, 2015
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 15 seconds ago –
Tools for package owners.