From e54c9b2850dd9beed2b89c9d096249175ec6e3db Mon Sep 17 00:00:00 2001 From: dudaodong Date: Thu, 1 Jun 2023 10:44:00 +0800 Subject: [PATCH] doc: add new function to readme file --- README.md | 21 ++++++++++++++++++++- README_zh-CN.md | 23 +++++++++++++++++++++++ docs/strutil.md | 2 +- docs/strutil_zh-CN.md | 3 +++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30494df..02bd1c1 100644 --- a/README.md +++ b/README.md @@ -491,7 +491,12 @@ import "github.com/duke-git/lancet/v2/datetime" - **IsLeapYear** : check if param `year` is leap year or not. [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#IsLeapYear)] [[play](https://go.dev/play/p/xS1eS2ejGew)] - +- **BetweenSeconds** : returns the number of seconds between two times. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#BetweenSeconds)] +- **DayOfYear** : returns which day of the year the parameter date `t` is. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#DayOfYear)] +- **IsWeekend** : checks if passed time is weekend or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#IsWeekend)] ### 8. Datastructure package constains some common data structure. eg. list, linklist, stack, queue, set, tree, graph. @@ -596,6 +601,10 @@ import "github.com/duke-git/lancet/v2/fileutil" - **ReadCsvFile** : read file content into slice. [[doc](https://github.com/duke-git/lancet/blob/main/docs/fileutil.md#ReadCsvFile)] [[play](https://go.dev/play/p/OExTkhGEd3_u)] +- **WriteBytesToFile** : write bytes to target file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/fileutil.md#WriteBytesToFile)] +- **WriteStringToFile** : write string to target file. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/fileutil.md#WriteStringToFile)] ### 10. Formatter contains some functions for data formatting. @@ -803,6 +812,10 @@ import "github.com/duke-git/lancet/v2/mathutil" - **LCM** : return Least Common Multiple (LCM) of integers. [[doc](https://github.com/duke-git/lancet/blob/main/docs/mathutil.md#LCM)] [[play](https://go.dev/play/p/EjcZxfY7G_g)] +- **Cos** : return the cosine of the radian argument. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/mathutil.md#Cos)] +- **Sin** : return the sine of the radian argument. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/mathutil.md#Sin)] ### 14. Netutil package contains functions to get net information and send http request. @@ -1292,6 +1305,10 @@ import "github.com/duke-git/lancet/v2/strutil" - **Capitalize** : converts the first character of source string to upper case and the remaining to lower case. [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#Capitalize)] [[play](https://go.dev/play/p/2OAjgbmAqHZ)] +- **ContainsAll** : return true if target string contains all the substrings. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#ContainsAll)] +- **ContainsAny** : return true if target string contains any one of the substrings. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#ContainsAny)] - **IsString** : checks if the parameter value data type is string or not. [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#IsString)] [[play](https://go.dev/play/p/IOgq7oF9ERm)] @@ -1373,6 +1390,8 @@ import "github.com/duke-git/lancet/v2/strutil" - **SplitAndTrim** : splits string `str` by a string `delimiter` to a slice, and calls Trim to every element of slice. [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#SplitAndTrim)] [[play](https://go.dev/play/p/ZNL6o4SkYQ7)] +- **HideString** : Hide some chars in source string with param `replaceChar`. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil.md#HideString)] ### 21. System package contain some functions about os, runtime, shell command. diff --git a/README_zh-CN.md b/README_zh-CN.md index a9ba189..060349c 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -490,6 +490,15 @@ import "github.com/duke-git/lancet/v2/datetime" - **IsLeapYear** :验证是否是闰年。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#IsLeapYear)] [[play](https://go.dev/play/p/xS1eS2ejGew)] +- **IsLeapYear** : check if param `year` is leap year or not. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime.md#IsLeapYear)] + [[play](https://go.dev/play/p/xS1eS2ejGew)] +- **BetweenSeconds** : 返回两个时间的间隔秒数。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#BetweenSeconds)] +- **DayOfYear** : 返回参数日期是一年中的第几天。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#DayOfYear)] +- **IsWeekend** : 判断日期是否是周末。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/datetime_zh-CN.md#IsWeekend)] ### 8. datastructure 包含一些普通的数据结构实现。例如:list, linklist, stack, queue, set, tree, graph. @@ -594,6 +603,10 @@ import "github.com/duke-git/lancet/v2/fileutil" - **ReadCsvFile** : 读取 csv 文件内容到切片。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/fileutil_zh-CN.md#ReadCsvFile)] [[play](https://go.dev/play/p/OExTkhGEd3_u)] +- **WriteBytesToFile** : 将bytes写入文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/fileutil_zh-CN.md#WriteBytesToFile)] +- **WriteStringToFile** : 将字符串写入文件。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/fileutil_zh-CN.md#WriteStringToFile)] ### 10. formatter 格式化器包含一些数据格式化处理方法。 @@ -801,6 +814,10 @@ import "github.com/duke-git/lancet/v2/mathutil" - **LCM** : 求最小公倍数。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/mathutil_zh-CN.md#LCM)] [[play](https://go.dev/play/p/EjcZxfY7G_g)] +- **Cos** : 计算弧度的余弦值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/mathutil_zh-CN.md#Cos)] +- **Sin** : 计算弧度的正弦值。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/mathutil_zh-CN.md#Sin)] ### 14. netutil 网络包支持获取 ip 地址,发送 http 请求。 @@ -1293,6 +1310,10 @@ import "github.com/duke-git/lancet/v2/strutil" - **Capitalize** : 将字符串的第一个字符转换为大写。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil_zh-CN.md#Capitalize)] [[play](https://go.dev/play/p/2OAjgbmAqHZ)] +- **ContainsAll** : 判断字符串是否包括全部给定的子字符串切片。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil_zh-CN.md#ContainsAll)] +- **ContainsAny** : 判断字符串是否包括给定的子字符串切片中任意一个子字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil_zh-CN.md#ContainsAny)] - **IsString** : 判断传入参数的数据类型是否为字符串。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil_zh-CN.md#IsString)] [[play](https://go.dev/play/p/IOgq7oF9ERm)] @@ -1374,6 +1395,8 @@ import "github.com/duke-git/lancet/v2/strutil" - **SplitAndTrim** : 将字符串 str 按字符串 delimiter 拆分为一个切片,并对该数组的每个元素调用 Trim。忽略 Trim 后为空的元素。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil_zh-CN.md#SplitAndTrim)] [[play](https://go.dev/play/p/ZNL6o4SkYQ7)] +- **HideString** : 隐藏源字符串中的一些字符。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/strutil_zh-CN.md#HideString)] ### 21. system 包含 os, runtime, shell command 的相关函数。 diff --git a/docs/strutil.md b/docs/strutil.md index 09ccc14..c601278 100644 --- a/docs/strutil.md +++ b/docs/strutil.md @@ -1284,7 +1284,7 @@ func main() { ### HideString -

HideString hide some chars in source string with param `replaceChar`. replace range is origin[start : end]. [start, end).

+

Hide some chars in source string with param `replaceChar`. replace range is origin[start : end]. [start, end).

Signature: diff --git a/docs/strutil_zh-CN.md b/docs/strutil_zh-CN.md index bfd517a..fb00385 100644 --- a/docs/strutil_zh-CN.md +++ b/docs/strutil_zh-CN.md @@ -56,6 +56,9 @@ import ( - [Trim](#Trim) - [SplitAndTrim](#SplitAndTrim) - [HideString](#HideString) +- [ContainsAll](#ContainsAll) +- [ContainsAny](#ContainsAny) +