宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-07-05 0d8f5fc8a516bfd07e425909e4a4432600572ee7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
//  IntExtension.swift
//  YYBase
//
//  Created by alvin_y on 2020/3/13.
//  Copyright © 2020 yangwang. All rights reserved.
//
 
import UIKit
 
extension  Int{
    
    func string() -> String{
        return "\(self)"
    }
    
    /// 数字转换大写 1 -> 一
    /// - Parameter number: <#number description#>
    /// - Returns: <#description#>
    func intIntoString() -> String{
        switch self {
        case 1:
            return "一"
        case 2:
            return "二"
        case 3:
            return "三"
        case 4:
            return "四"
        case 5:
            return "五"
        case 6:
            return "六"
        case 7:
            return "七"
        case 8:
            return "八"
        case 9:
            return "九"
        case 10:
            return "十"
        default:
            return ""
        }        
    }
   
}
extension String{
    func stringToInt() -> Int{
        switch self {
        case "一":
            return 1
        case "二":
            return 2
        case "三":
            return 3
        case "四":
            return 4
        case "五":
            return 5
        case "六":
            return 6
        case "七":
            return 7
        case "八":
            return 8
        case "九":
            return 9
        case "十":
            return 10
        default:
            return 0
        }
    }
}