parse

package
v1.16.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package parse has the small text readers that the loaders of package model share: fields, integers and decimal numbers read from byte slices with no allocation (an OBJ file of a million triangles has some seven million of them).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Field

func Field(line []byte) (field, rest []byte)

Field returns the first field of the line (the bytes up to the next separator) and the rest of the line after it, or a nil field when the line has no more.

func Finite

func Finite(f float64) bool

Finite is true when f is neither infinite nor NaN.

func Float

func Float(b []byte) (float64, bool)

Float reads a decimal number such as -12, .5, 3.25e-4 or 1E+3. The common numbers (at most 15 digits and a small exponent) are exact by the method of Clinger and take no allocation; the others go to strconv. It is false when the field is not a number. "inf" and "nan" are numbers: the caller says whether it takes them.

func Int

func Int(b []byte) (int, bool)

Int reads a decimal integer with an optional sign. It is false for anything else and for a number that does not fit an int32.

func IsSpace

func IsSpace(c byte) bool

IsSpace is true for the bytes that separate fields: a space, a tab and a carriage return.

func Trim

func Trim(line []byte) []byte

Trim removes the separators at both ends of the line.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL