Skip to content

Commit e6080b6

Browse files
committed
v0.4.0
1 parent 0a2bce5 commit e6080b6

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
# Changelog
22

33

4-
## 0.4.0 (2016-mm-dd)
4+
## 0.4.0 (2016-01-29)
55

66
* **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+
```
823

924

1025
## 0.3.0 (2015-12-29)
1126

1227
* fix "当字符串中有非中文的时候,会出现下标越界的情况"(影响 `pinyin.LazyPinyin``pinyin.Slug` ([#1](https://github.com/mozillazg/go-pinyin/issues/1)))
1328
* 调整对非中文字符的处理:当遇到没有拼音的字符时,直接忽略
14-
```
29+
```go
1530
// before
1631
fmt.Println(pinyin.Pinyin("中国人abc", pinyin.NewArgs()))
1732
[[zhong] [guo] [ren] [] [] []]

pinyin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
// Meta
99
const (
10-
Version = "0.3.0"
10+
Version = "0.4.0"
1111
Author = "mozillazg, 闲耘"
1212
License = "MIT"
1313
Copyright = "Copyright (c) 2016 mozillazg, 闲耘"

0 commit comments

Comments
 (0)