Documentation
¶
Overview ¶
get-c-class.go
/ +build OMIT
/ +build OMIT
csvfunc.go
fileText.go
strings.go
tools.go
Index ¶
- func AppendAt(slice []string, pos int, insert ...string) []string
- func ByteToHexStr(bytes []byte) string
- func CharsetToUtf8(str string) string
- func Check(err error, message ...string)
- func CheckP(err error)
- func DeleteSl(slice []string, pos int) []string
- func DeleteSl1(slice []string, pos int) []string
- func DetectCharsetFile(filename string) (name string)
- func DetectCharsetStr(inputStr string) (name string)
- func FileCharsetSwitch(inCharset, outCharset, inFilename string, outFilename ...string)
- func FindDate(inputString, fmtDate string) []string
- func FormatDate(fmtDate string, inpDate string) time.Time
- func FormatText(str string, max int) string
- func GenFileName() string
- func GetEOL(filename string) string
- func GetSep(str string) []string
- func GetStrIndex(slice []string, item string) int
- func IsDate(inString string) bool
- func IsError(err error) bool
- func IsExist(slice [][]string, cmpRow []string) bool
- func IsFloat(inString string) bool
- func LinesToTextFile(filename string, values interface{}) error
- func Md5String(inString string) string
- func Md5Sum(filename string) string
- func NewDateFormat() []string
- func PathSep() string
- func Preppend(slice []string, prepend ...string) []string
- func ReadCsv(filename, comma string, fields, startLine int, endLine ...int) [][]string
- func ReadFile(filename string) []byte
- func ReadJson(filename string, interf interface{})
- func RemovIfExist(filename string)
- func RemoveDupSl(slice []string) []string
- func RemoveNonAlNum(inString string) string
- func ReplaceSpace(inString string) string
- func SearchSl(find string, table [][]string, cs, ww, rx bool) ([][]string, error)
- func SetEOL(filename, eol string)
- func SliceSortDate(slice [][]string, fmtDate string, dateCol, secDateCol int, ascendant bool) [][]string
- func SliceSortFloat(slice [][]string, col int, ascendant bool, decimalChar string)
- func SliceSortString(slice [][]string, col int, ascendant, caseSensitive bool)
- func StringDecimalSwitchFloat(decimalChar, inString string) float64
- func StringToCharacterClasses(inpString string, caseSensitive, strictMode bool) string
- func TempMake(prefix string) string
- func TempRemove(fName string)
- func TextFileToLines(filename string, opt ...string) []string
- func TrimSpace(inputString string, cmds ...string) string
- func TruncateString(inString, prefix string, max, option int) string
- func Use(vals ...interface{})
- func WriteCsv(filename, comma string, rows [][]string)
- func WriteJson(filename string, interf interface{})
- func WriteTextFile(filename, data string, appendIfExist ...bool)
- type CharsetList
- type Entry
- type File
- type RowStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CharsetToUtf8 ¶
Get charset and convert to utf-8 if needed
func DetectCharsetFile ¶
Detect encoding type for files
func DetectCharsetStr ¶
Detect encoding type for strings
func FileCharsetSwitch ¶
Change charset of a text file
func FindDate ¶
Find the date in relation to the given format. (French format like %d, %m, %y or Y%). input fmtDate: "%d-%m-%y %H:%M:%S"
func FormatDate ¶
Change date format to unix model with pattern like: fmtDate:='%d-%m-%y %H:%M:%S' --> '$y-%m-%d %H:%M:%S' Note: year format must be in lowercase ...
func FormatText ¶
Format words text to fit (column/windows with limited width) "max" chars.
func GetStrIndex ¶
Get index of a string in a slice
func LinesToTextFile ¶
Write slice to file
func NewDateFormat ¶
func NewDateFormat() []string
func ReadJson ¶
func ReadJson(filename string, interf interface{})
read json datas from file to given interface / structure ReadJson(filename, &person)
func RemovIfExist ¶
func RemovIfExist(filename string)
func RemoveDupSl ¶
Remove duplicat entry in a string slice
func ReplaceSpace ¶
replace all [[:space::]] with underscore "_"
func SetEOL ¶
func SetEOL(filename, eol string)
Open file and convert EOL (CR, LF, CRLF) then write it back.
func SliceSortDate ¶
func SliceSortDate(slice [][]string, fmtDate string, dateCol, secDateCol int, ascendant bool) [][]string
Sort 2d string slice with date inside
func SliceSortFloat ¶
Sort 2d string with float value
func SliceSortString ¶
Sort 2d string slice
func StringDecimalSwitchFloat ¶
Convert comma to dot if needed and return 0 if input string is empty.
func StringToCharacterClasses ¶
Convert string to character classes equivalent's string
func TextFileToLines ¶
Load text file to slice, opt are same as TrimSpace function "-c, -s, +& or -&" and can be cumulative. This function Reconize "CR", "LF", "CRLF", and convert charset to utf-8
func TruncateString ¶
Reduce string length for display (prefix is separator like: "...", option=0 -> put separator at the begening of output string. option=1 -> center, is where separation is placed. option=2 -> line feed, trunc the whole string using LF without shorting it. max, is max char length of the output string.
func WriteJson ¶
func WriteJson(filename string, interf interface{})
Write json datas to file from given interface / structure i.e: WriteJson(filename, &person)
func WriteTextFile ¶
Write string to file low lvl format
Types ¶
type CharsetList ¶
func NewCharsetList ¶
func NewCharsetList() CharsetList
func (*CharsetList) GetCharset ¶
func (cl *CharsetList) GetCharset(pos int) (chLong, chShort string)
func (*CharsetList) GetPos ¶
func (cl *CharsetList) GetPos(ch string) (posLong, posShort int)
func (*CharsetList) Init ¶
func (cl *CharsetList) Init()
type File ¶
type File struct { Path string Name string NameNoExt string Ext string RealPath string RealName string Output string OutputNewExt string Absolute string OsSep string OsListSep string }
func SplitFilePath ¶
Split full filename into path, ext, name, ... optionally add suffix before original extension or change extension
type RowStore ¶
func AppendIfMissing ¶
Append to slice if not already exist (RowStore version)
func AppendIfMissingC ¶
Append to slice if RowStore.cnt value does not already exist (Quote version)
func FindCountStr ¶
Get count of non alphanum chars in a string in struct(RowStore) format