xlib/README.md

48 строки
1.4 KiB
Markdown
Исходник Обычный вид История

2018-12-15 20:48:08 +03:00
### golang util library ###
2019-01-21 02:17:20 +03:00
(c) softlandia@gmail.com
2018-12-15 20:48:08 +03:00
download: go get -u github.com/softlandia/xLib
2019-01-14 19:53:25 +03:00
install: go install
2018-12-15 20:48:08 +03:00
2019-01-21 02:17:20 +03:00
dependences:
------------
>"golang.org/x/text/encoding/charmap"
>"golang.org/x/text/transform"
2018-12-15 20:48:08 +03:00
functions:
1. FileExists(name string) bool
2. StrContainBackSlash(s string) bool
3. StrIsPrintRune(s string) bool
4. ChangeFileExt(iFileName, newExt string) string
2019-01-14 19:53:25 +03:00
5. SeekFileToString(fileName, strToSearch string) (*bufio.Scanner, error)
2019-01-21 02:17:20 +03:00
6. CodePageDetect(fn string) (int, error)
7. ConvertStrCodePage(s string, fromCP, toCP int64) (string, error)
2019-01-14 19:53:25 +03:00
identifyCodePage - sample of using function CodePageDetect
2018-12-15 20:48:08 +03:00
2019-01-14 19:53:25 +03:00
_________________________________________________________________________
func FileExists(name string) bool
2018-12-15 20:48:08 +03:00
return true if file exist
func StrContainBackSlash(s string) bool
2019-01-21 02:17:20 +03:00
return true if last char in string s == '\'
2018-12-15 20:48:08 +03:00
2019-01-14 19:53:25 +03:00
func StrIsPrintRune(s string) bool
return true if input string consists only of printable rune
func ChangeFileExt(iFileName, newExt string) string
change file name extention
2018-12-15 20:48:08 +03:00
2019-01-14 19:53:25 +03:00
func SeekFileToString(fileName, strToSearch string) (*bufio.Scanner, error)
read text file fileName and return Scanner at line strToSearch
2018-12-15 20:48:08 +03:00
2019-01-14 19:53:25 +03:00
func CodePageDetect(fn string) (int, error)
2019-01-21 02:17:20 +03:00
read text file fn and return code page, detect only IBM CodePage866 and Windows1251
func ConvertStrCodePage(s string, fromCP, toCP int64) (string, error)
convert string from one code page to another