Skip to content

Commit

Permalink
fix(bin): func CleanoutString error when param is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
conero committed May 22, 2024
1 parent f2e8eeb commit c7ab0e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
- **bin/doc**
- feat: 新增包实现对命令行文档的解析,新增控制类 Doc 等实现配置信息解析

- **bin**
- fixed: 修复 CleanoutString 函数因为空而报错的引起的异常

- **culture/pinyin**
- feat: 新增类型 *ZhSentences* 并实现句长,字符集获取计算
- feat: Pinyin 新增方法 *Len* 用于计算拼音字典长度
Expand Down
3 changes: 3 additions & 0 deletions bin/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,9 @@ func isVaildCmd(c string) bool {
// `'string'` => `string`
// `'"string"'` => `"string"`
func CleanoutString(ss string) string {
if ss == "" {
return ss
}
ssLen := len(ss)
first, last := ss[0:1], ss[ssLen-1:]
if first == last {
Expand Down

0 comments on commit c7ab0e1

Please sign in to comment.