-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fidel_Yiu
committed
Jul 16, 2021
0 parents
commit 25498bc
Showing
30 changed files
with
615,772 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` | 汉字字符串转部首相关方法 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) | ||
} |
Oops, something went wrong.