diff options
| author | b5f0d6c3 <[email protected]> | 2022-05-01 09:22:04 +0800 |
|---|---|---|
| committer | b5f0d6c3 <[email protected]> | 2022-05-01 09:22:04 +0800 |
| commit | 32e8ebff314559cdab885d3501aecefaac8e6310 (patch) | |
| tree | b4f5d098fb5738fbf30e58fd96a80fc0fff647f6 /mkvlib/utils.go | |
| parent | 43d69bb6cde69d9b9f68ec61e7c971f1619f64e4 (diff) | |
update mkvlib:fix bug
Diffstat (limited to 'mkvlib/utils.go')
| -rw-r--r-- | mkvlib/utils.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mkvlib/utils.go b/mkvlib/utils.go index 802b94e..3f9d935 100644 --- a/mkvlib/utils.go +++ b/mkvlib/utils.go @@ -196,3 +196,18 @@ func findFonts(dir string) []string { list, _ := findPath(dir, `\.((?i)(ttf)|(otf)|(ttc))$`) return list } + +func stringDeduplication(str string) string { + _s := "" + _m := make(map[rune]int) + _rs := []rune(str) + for i, r := range _rs { + if _, ok := _m[r]; !ok { + _m[r] = i + } + } + for _, v := range _m { + _s += string(_rs[v]) + } + return _s +} |
