...
|
...
|
@@ -27,23 +27,6 @@ func Intersect(nums1 []int64, nums2 []int64) []int64 { |
|
|
return intersection
|
|
|
}
|
|
|
|
|
|
////求交集
|
|
|
//func intersect(slice1, slice2 []int64) []int64 {
|
|
|
// m := make(map[int64]int)
|
|
|
// nn := make([]int64, 0)
|
|
|
// for _, v := range slice1 {
|
|
|
// m[v]++
|
|
|
// }
|
|
|
//
|
|
|
// for _, v := range slice2 {
|
|
|
// times, _ := m[v]
|
|
|
// if times == 1 {
|
|
|
// nn = append(nn, v)
|
|
|
// }
|
|
|
// }
|
|
|
// return nn
|
|
|
//}
|
|
|
|
|
|
// Difference 求差集 slice1-并集
|
|
|
func Difference(slice1, slice2 []int64) []int64 {
|
|
|
m := make(map[int64]int)
|
...
|
...
|
@@ -83,7 +66,7 @@ func Round(value float64, places int32) float64 { |
|
|
|
|
|
// NumberToCNNumber 数字转中文数字
|
|
|
func NumberToCNNumber(num int) string {
|
|
|
chineseMap := []string{"阶段", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千"}
|
|
|
chineseMap := []string{"", "十", "百", "千", "万", "十", "百", "千", "亿", "十", "百", "千"}
|
|
|
chineseNum := []string{"零", "一", "二", "三", "四", "五", "六", "七", "八", "九"}
|
|
|
var listNum []int
|
|
|
for ; num > 0; num = num / 10 {
|
...
|
...
|
@@ -103,8 +86,9 @@ func NumberToCNNumber(num int) string { |
|
|
copyChinese = strings.Replace(copyChinese, "零十", "零", 1)
|
|
|
copyChinese = strings.Replace(copyChinese, "零百", "零", 1)
|
|
|
copyChinese = strings.Replace(copyChinese, "零千", "零", 1)
|
|
|
copyChinese = strings.Replace(copyChinese, "零零", "零", 1)
|
|
|
copyChinese = strings.Replace(copyChinese, "零圆", "圆", 1)
|
|
|
copyChinese = strings.Replace(copyChinese, "零零", "", 1)
|
|
|
//copyChinese = strings.Replace(copyChinese, "零圆", "", 1)
|
|
|
//copyChinese = strings.Replace(copyChinese, "零", "", 1)
|
|
|
|
|
|
if copyChinese == chinese {
|
|
|
break
|
...
|
...
|
@@ -113,6 +97,6 @@ func NumberToCNNumber(num int) string { |
|
|
}
|
|
|
}
|
|
|
|
|
|
return "第" + chinese
|
|
|
return "第" + chinese + "阶段"
|
|
|
|
|
|
} |
...
|
...
|
|