Skip to content

Commit

Permalink
发布v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidel_Yiu committed Jul 16, 2021
0 parents commit 25498bc
Show file tree
Hide file tree
Showing 30 changed files with 615,772 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
### Example user template template
### Example user template

# IntelliJ project files
.idea
*.iml
out
gen
### Go template
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

main.go

29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## 1.YiuGo工具类

`yiu-go-tool`的汉字库

## 2.安装

```bash
go get -u github.com/fidelyiu/yiu-go-han_zi
```

如 goproxy.cn 更新失败,尝试指定版本

```bash
go get github.com/fidelyiu/[email protected]
```

## 3.使用

使用方式和`yiu-go-tool`一样,引入后第一次编译会很慢。

## 4.目前支持

| 对象类型 | 工具包名 | 说明 |
| ----------- | -------------- | ----------------------------------------- |
| `汉字` | `yiuHanZi` | 字符串和汉字相关的方法 |
| `汉字_list` | `yiuHanZiList` | 字符串数组和汉字相关方法 |
| `拼音` | `yiuPinYin` | 汉字字符串转拼音相关方法 |
| `笔画` | `yiuBiHua` | 汉字字符串转笔画相关方法 |
| `部首` | `yiuBuShou` | 汉字字符串转部首相关方法 |
7 changes: 7 additions & 0 deletions bi_hua/bi_hua_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package yiuBiHua

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

func GetByRune(r rune) uint {
return yiuAll.YiuBiHuaGetByRune(r)
}
8 changes: 8 additions & 0 deletions bu_shou/bu_shou_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package yiuBuShou

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// GetByRune 根据rune获取部首
func GetByRune(r rune) string {
return yiuAll.YiuBuShouGetByRune(r)
}
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/fidelyiu/yiu-go-han-zi

go 1.16

require github.com/fidelyiu/yiu-go-tool v1.1.5
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github.com/fidelyiu/yiu-go-tool v1.1.4 h1:OquwnziTPFZaSQh7odf/4VRzlW12c1IkQouBgF/hKuM=
github.com/fidelyiu/yiu-go-tool v1.1.4/go.mod h1:WIXj//r6TbybRgHyN1I3qCsWUJJMddehf6U+mDcAUYI=
github.com/fidelyiu/yiu-go-tool v1.1.5 h1:1c5bgNgB05t4KiI8EM9ux+VqPD0FGAkS2MBwAfreTco=
github.com/fidelyiu/yiu-go-tool v1.1.5/go.mod h1:WIXj//r6TbybRgHyN1I3qCsWUJJMddehf6U+mDcAUYI=
github.com/psampaz/slice v0.2.0 h1:QmWgx8ROo3Iz1RuumrKOlObLp2yqahs73pXZ3QsYCME=
github.com/psampaz/slice v0.2.0/go.mod h1:WzQrs9ppHnGp88hQSh4RjJ7i0bGBv8/nNBPBi5itkYc=
8 changes: 8 additions & 0 deletions han_zi/han_zi_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package yiuHanZi

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// GetFirstLetterStr 获取首字母大写字符串
func GetFirstLetterStr(s string) string {
return yiuAll.YiuHanZiGetFirstLetterStr(s)
}
45 changes: 45 additions & 0 deletions han_zi/han_zi_is.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package yiuHanZi

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// IsGe 字符串是否大于等于
//
// - 汉字在前,非汉字在后
// - 按拼音、音调、部首、笔画排序
func IsGe(s1, s2 string) bool {
return yiuAll.YiuHanZiIsGe(s1, s2)
}

// IsGt 字符串是否大于
//
// - 汉字在前,非汉字在后
// - 按拼音、音调、部首、笔画排序
func IsGt(s1, s2 string) bool {
return yiuAll.YiuHanZiIsGt(s1, s2)
}

// IsHanZi 是否是汉字
func IsHanZi(i rune) bool {
return yiuAll.YiuHanZiIsHanZi(i)
}

// IsLe 字符串是否小于等于
//
// - 汉字在前,非汉字在后
// - 按拼音、音调、部首、笔画排序
func IsLe(s1, s2 string) bool {
return yiuAll.YiuHanZiIsLe(s1, s2)
}

// IsLt 字符串是否小于
//
// - 汉字在前,非汉字在后
// - 按拼音、音调、部首、笔画排序
func IsLt(s1, s2 string) bool {
return yiuAll.YiuHanZiIsLt(s1, s2)
}

// IsNotHanZi 是否不是汉字
func IsNotHanZi(i rune) bool {
return yiuAll.YiuHanZiIsNotHanZi(i)
}
22 changes: 22 additions & 0 deletions han_zi/han_zi_to.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package yiuHanZi

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// ToBiHuaList 汉字转笔画List,没有笔画的就为空
func ToBiHuaList(s string) []uint {
return yiuAll.YiuHanZiToBiHuaList(s)
}

func ToBuShouList(s string) []string {
return yiuAll.YiuHanZiToBuShouList(s)
}

// ToPinYinFirstLetterList 获取拼音首字母大写
func ToPinYinFirstLetterList(s string) []string {
return yiuAll.YiuHanZiToPinYinFirstLetterList(s)
}

// ToPinYinList 汉字转拼音List,没有拼音的就为空
func ToPinYinList(s string) []string {
return yiuAll.YiuHanZiToPinYinList(s)
}
13 changes: 13 additions & 0 deletions han_zi_list/han_zi_list_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package yiuHanZiList

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// GetAsc 按照拼音将字符串升序排序
func GetAsc(list []string) []string {
return yiuAll.YiuHanZiListGetAsc(list)
}

// GetDesc 按照拼音将字符串降序排序
func GetDesc(list []string) []string {
return yiuAll.YiuHanZiListGetDesc(list)
}
13 changes: 13 additions & 0 deletions han_zi_list/han_zi_list_op.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package yiuHanZiList

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// OpAsc 将字符串数组按拼音升序排序
func OpAsc(list *[]string) {
yiuAll.YiuHanZiListOpAsc(list)
}

// OpDesc 将字符串数组按拼音降序排序
func OpDesc(list *[]string) {
yiuAll.YiuHanZiListOpDesc(list)
}
18 changes: 18 additions & 0 deletions pin_yin/pin_yin_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package yiuPinYin

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// GetByRune 根据rune获取拼音
func GetByRune(r rune) []string {
return yiuAll.YiuPinYinGetByRune(r)
}

// GetDefByRune 根据rune获取默认拼音
func GetDefByRune(r rune) string {
return yiuAll.YiuPinYinGetDefByRune(r)
}

// GetFirstLetterByRune 根据rune获取拼音的首字母大写
func GetFirstLetterByRune(r rune) string {
return yiuAll.YiuPinYinGetFirstLetterByRune(r)
}
31 changes: 31 additions & 0 deletions pin_yin/pin_yin_is.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package yiuPinYin

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// IsGe 判断拼音字符串是否大于等于
// - 大小写一样,小写优于大写
// - 声调按顺序排序
func IsGe(s1, s2 string) bool {
return yiuAll.YiuPinYinIsGe(s1, s2)
}

// IsGt 判断拼音字符串是否大于
// - 大小写一样,小写优于大写
// - 声调按顺序排序
func IsGt(s1, s2 string) bool {
return yiuAll.YiuPinYinIsGt(s1, s2)
}

// IsLe 判断拼音字符串是否小于等于
// - 大小写一样,小写优于大写
// - 声调按顺序排序
func IsLe(s1, s2 string) bool {
return yiuAll.YiuPinYinIsLe(s1, s2)
}

// IsLt 判断拼音字符串是否小于
// - 大小写一样,小写优于大写
// - 声调按顺序排序
func IsLt(s1, s2 string) bool {
return yiuAll.YiuPinYinIsLt(s1, s2)
}
18 changes: 18 additions & 0 deletions pin_yin/pin_yin_to.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package yiuPinYin

import yiuAll "github.com/fidelyiu/yiu-go-han-zi/yiu_all"

// ToLower 将带音调的字符替换成没有音调的,并全换成小写
func ToLower(str string) string {
return yiuAll.YiuPinYinToLower(str)
}

// ToNoTone 将带音调的字符替换成没有音调的
func ToNoTone(str string) string {
return yiuAll.YiuPinYinToNoTone(str)
}

// ToUpper 将带音调的字符替换成没有音调的,并全换成大写
func ToUpper(str string) string {
return yiuAll.YiuPinYinToUpper(str)
}
10 changes: 10 additions & 0 deletions yiu_all/bi_hua_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package yiuAll

import yiuVar "github.com/fidelyiu/yiu-go-han-zi/yiu_var"

func YiuBiHuaGetByRune(r rune) uint {
if YiuHanZiIsNotHanZi(r) {
return 0
}
return yiuVar.FuncHanZiGetBiHua(r)
}
11 changes: 11 additions & 0 deletions yiu_all/bu_shou_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package yiuAll

import yiuVar "github.com/fidelyiu/yiu-go-han-zi/yiu_var"

// YiuBuShouGetByRune 根据rune获取部首
func YiuBuShouGetByRune(r rune) string {
if YiuHanZiIsNotHanZi(r) {
return ""
}
return yiuVar.FuncHanZiGetBuShou(r)
}
8 changes: 8 additions & 0 deletions yiu_all/han_zi_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package yiuAll

import yiuStrList "github.com/fidelyiu/yiu-go-tool/string_list"

// YiuHanZiGetFirstLetterStr 获取首字母大写字符串
func YiuHanZiGetFirstLetterStr(s string) string {
return yiuStrList.ToStr(yiuStrList.GetDeleteEmptyEl(YiuHanZiToPinYinFirstLetterList(s)))
}
Loading

0 comments on commit 25498bc

Please sign in to comment.