{"id":18309016,"url":"https://github.com/tekintian/strutils","last_synced_at":"2025-04-05T17:32:28.834Z","repository":{"id":242329393,"uuid":"809279323","full_name":"tekintian/strutils","owner":"tekintian","description":"go语言里面高效，符合使用习惯的字符串相关的实用工具函数 The effective, idiomatic golang utils for go string ","archived":false,"fork":false,"pushed_at":"2024-08-25T13:44:49.000Z","size":123,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-21T08:11:27.871Z","etag":null,"topics":["camel-case","go","go-utils","golang","kebab-case","regexp","regexp-cache","snake-case","string","string-utils","strings","tools","utils"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tekintian.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-02T08:34:46.000Z","updated_at":"2024-11-25T05:40:49.000Z","dependencies_parsed_at":"2024-06-16T07:54:29.364Z","dependency_job_id":"ef6efacf-8740-4be2-b49e-cffd5943619b","html_url":"https://github.com/tekintian/strutils","commit_stats":null,"previous_names":["tekintian/go-strutils","tekintian/gostrutils","tekintian/strutils","tekintian/go-str-utils"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekintian%2Fstrutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekintian%2Fstrutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekintian%2Fstrutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekintian%2Fstrutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tekintian","download_url":"https://codeload.github.com/tekintian/strutils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247375152,"owners_count":20928957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camel-case","go","go-utils","golang","kebab-case","regexp","regexp-cache","snake-case","string","string-utils","strings","tools","utils"],"created_at":"2024-11-05T16:09:59.191Z","updated_at":"2025-04-05T17:32:23.815Z","avatar_url":"https://github.com/tekintian.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go 语言字符串相关实用工具库 go string related utils\n\n本仓库只干一件事, 就是只做 go 语言中的字符串相关的实用函数或者方法， 当然是官方库 https://pkg.go.dev/strings 中未实现的，官方已有的实现我们不重复造轮子！\n\n欢迎大家踊跃 PR，一起完善这个工具库！\n\n如果你喜欢，请帮忙点亮免费小红星，您的小红星就是我们持续更新的动力！\n\n## 目前已完成函数\n\n1. 各种命名转换函数 naming_convert.go\n   **包括:**\n\n- CamelStr 大驼峰 单词全部首字母大写 如: UserName\n\n- SmallCamelStr 小驼峰 第一个单词首字母小写,其他大写, 如: userName\n\n- SnakeStr 单词全部小写,使用下划线链接, 如: user_name\n\n- KebabStr 单词全部小写,使用 中划线链接 如: user-name\n\n2. 字符串过滤函数 filters.go\n\n- Html2str html 字符串过滤函数，过滤所有 script,style 内容, 其他所有\u003c\\*\u003e中的内容, 将 1 个以上的换行回车空格替换为 1 个空格\n\n3. 字符串操作函数 handle.go\n\n- Substr 截取指定长度的字符串,支持英文,中文和其他多字节字符串\n\n4.  Regexp 编译缓存 cache_regexp.go\n\n- 这个工具就是为了提高高并发和同一个正则多次使用场景下的正则执行效率，因为字符串处理中经常要用到正则\n- [正则编译缓存基准测试结果请点击这里查看](docs/regexp_cache_benchmark.md)\n\n5. 字符串条件判断相关函数 condition.go\n\n- StrIsChinese 判断字符串是否是中文\n- StrContainsChinese 是否包含中文\n- StrContainsContinuousNum 是否包含连续的数字 可自定义连续数字的长度,默认 2\n\n更多的函数使用方法请参考 PKG 文档: https://pkg.go.dev/github.com/tekintian/strutils#pkg-index\n\n## 使用方法\n\ngo 版本环境, 最低 1.16, 我们建议你使用官方最新正式版, 这样就可以使用很多高级特性,比如 1.21 版本以上中的 slices 内置包等......\n\n- 安装最新版本依赖\n\n```sh\ngo get -u github.com/tekintian/strutils\n```\n\n- 使用示例\n\n```go\nimport (\n\t\"fmt\"\n\t\"github.com/tekintian/strutils\"\n)\n\nfunc main() {\n  camelStr := strutils.CamelStr(\"hello-world\")\n  fmt.Println(camelStr) // 输出： HelloWorld\n}\n\n```\n\n其他使用示例可参考 \\*\\_test.go 中的测试用例， 我们的每个函数都有测试用例， 部分函数还使用了 Fuzz 模糊测试技术 来确保我们函数的可靠和高效！ 同时也能帮助我们发现一些潜在的风险等......\n\n也可参考 go pkg 文档,地址: https://pkg.go.dev/github.com/tekintian/strutils\n\n## go 编码规范\n\n每个函数需要有对应的测试函数,以确保函数的可靠性, 编码规范请参考 go 官方的\n[Effective Go](https://go.dev/doc/effective_go.html) \u003cbr\u003e\n[Effective Go 国内加速地址](https://golang.google.cn/doc/effective_go)\n\n## go 参考文档\n\nGo 语言内置包 strings 文档 https://pkg.go.dev/strings\n\nGo 程序设计语言规范 https://go.dev/ref/spec\n\nFuzzing 模糊测试官方使用文档 https://go.dev/security/fuzz\n\ngolang官方文档 国内加速版本: https://golang.google.cn/doc/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekintian%2Fstrutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftekintian%2Fstrutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekintian%2Fstrutils/lists"}