linelengths

package
v0.0.0-...-c4af43d Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLineLengths

func GetLineLengths(filePath string, sourceString string) ([]int, error)

GetLineLengths counts the number of characters on each line of a file or string, returning a slice containing the length of each line in sequence.

Lines are defined to be separated by newline ('\n') characters. If the newline character is preceded by a carriage return ('\r'), this will also be treated as part of the separator.

If filePath is not empty, the function attempts to count the lines of the file at that path, otherwise lines in sourceString are counted.

Note: there may not be much useful information to be gathered by distinguishing between line lengths when they get very long. It may be pragmatic to just report all lines above e.g. 64K as 64K long.

Types

This section is empty.

Jump to

Keyboard shortcuts

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