摘要: golang 按行读取文件 file, err := os.Open("app-2019-06-01.log") if err != nil { log.Fatal(err) } defer file.Close() scanner := bufio.NewScanner(file) for sca 阅读全文
posted @ 2021-12-02 17:58 醒日是归时 阅读(40) 评论(0) 推荐(0) 编辑
摘要: //判断文件是否存在 存在返回 true 不存在返回false func checkFileIsExist(filename string) bool { var exist = true if _, err := os.Stat(filename); os.IsNotExist(err) { ex 阅读全文
posted @ 2021-12-02 17:46 醒日是归时 阅读(454) 评论(0) 推荐(0) 编辑
摘要: // path package main import ( "fmt" "os" "path" "path/filepath" ) func main() { //Path操作 fmt.Println("Path操作 ") fmt.Println(path.Base("http://www.baid 阅读全文
posted @ 2021-12-02 17:40 醒日是归时 阅读(170) 评论(0) 推荐(0) 编辑
摘要: package main import "bytes" import "fmt" import "regexp" func main() { //这个测试一个字符串是否符合一个表达式。 match, _ := regexp.MatchString("p([a-z]+)ch", "peach") fm 阅读全文
posted @ 2021-12-02 14:21 醒日是归时 阅读(205) 评论(0) 推荐(0) 编辑