Categorygithub.com/shyang107/paw
repositorypackage
0.0.7-2021.1.21
Repository: https://github.com/shyang107/paw.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

paw

Functions

io

LineCount

LineCount counts the number of \n for reader r

func LineCount(r io.Reader) (int, error)

modify from "github.com/liuzl/goutil"

FileLineCount

FileLineCount counts the number of \n for file f

f : could be gzip file or plain text file

func FileLineCount(f string) (int, error)

modify from "github.com/liuzl/goutil"

ForEachLine

ForEachLine higher order function that processes each line of text by callback function.

The last non-empty line of input will be processed even if it has no newline.

br : read from br reader

callback : the function used to treatment the every line from br

func ForEachLine(br *bufio.Reader, callback func(string) error) error

modify from "github.com/liuzl/goutil"

path

IsFileExist

IsFileExist return true that fileName exist or false for not exist

func IsFileExist(fileName string) bool

IsDirExists

IsDirExists return true that dir is directory or false for not

func IsDirExists(dir string) bool

web

GetTitleAndURL

GetTitleAndURL get the title and URL of active tab of the current window of browser

browser : - "edge" for "Microsoft Edge" (default) : - "chrome" for "Google Chrome"

func GetTitleAndURL(browser string) (t, u string, err error)

GetTitle

GetTitle get the title of active tab of the current window of browser

func GetTitle(browser string) (string, error)

GetURL

GetURL get the URL of active tab of the current window of browser

func GetURL(browser string) (string, error)

text or string

GetAbbrString

GetAbbrString return a abbreviation string 'xxx...' of str with maximum length maxlen.

func GetAbbrString(str string, maxlen int) string

CountPlaceHolder

CountPlaceHolder return nHan and nASCII

nHan : number of occupied space in terminal for han-character

nASCII : number of occupied space in terminal for ASCII-character

func CountPlaceHolder(str string) (nHan int, nASCII int)

HasChineseChar

HasChineseChar return true for that str include chinese character

func HasChineseChar(str string) bool

Table