File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
3
4
- ## 0.4.0 (2016-mm-dd )
4
+ ## 0.4.0 (2016-01-29 )
5
5
6
6
* ** NEW** ` Args ` 结构体新增 field: ` Fallback func(r rune, a Args) []string `
7
- 用于处理没有拼音的字符(默认忽略没有拼音的字符)。
7
+ 用于处理没有拼音的字符(默认忽略没有拼音的字符):
8
+ ``` go
9
+ a := pinyin.NewArgs ()
10
+ a.Fallback = func (r rune, a pinyin.Args ) []string {
11
+ return []string {string (r + 1 )}
12
+ }
13
+ fmt.Println (pinyin.Pinyin (" 中国人abc" , a))
14
+ // Output: [[zhong] [guo] [ren] [b] [c] [d]]
15
+
16
+ // or
17
+ pinyin.Fallback = func (r rune, a pinyin.Args ) []string {
18
+ return []string {string (r)}
19
+ }
20
+ fmt.Println (pinyin.Pinyin (" 中国人abc" , pinyin.NewArgs ()))
21
+ // Output: [[zhong] [guo] [ren] [a] [b] [c]]
22
+ ```
8
23
9
24
10
25
## 0.3.0 (2015-12-29)
11
26
12
27
* fix "当字符串中有非中文的时候,会出现下标越界的情况"(影响 ` pinyin.LazyPinyin ` 和 ` pinyin.Slug ` ([ #1 ] ( https://github.com/mozillazg/go-pinyin/issues/1 ) ))
13
28
* 调整对非中文字符的处理:当遇到没有拼音的字符时,直接忽略
14
- ```
29
+ ``` go
15
30
// before
16
31
fmt.Println (pinyin.Pinyin (" 中国人abc" , pinyin.NewArgs ()))
17
32
[[zhong] [guo] [ren] [] [] []]
Original file line number Diff line number Diff line change 7
7
8
8
// Meta
9
9
const (
10
- Version = "0.3 .0"
10
+ Version = "0.4 .0"
11
11
Author = "mozillazg, 闲耘"
12
12
License = "MIT"
13
13
Copyright = "Copyright (c) 2016 mozillazg, 闲耘"
You can’t perform that action at this time.
0 commit comments