github.com/go-spring/spring-base@v1.1.3/cast/README.md (about)

     1  # cast
     2  
     3  Provides many conversion functions between types.
     4  
     5  ## Install
     6  
     7  ```
     8  go get github.com/go-spring/spring-base@v1.1.0-rc2 
     9  ```
    10  
    11  ## Import
    12  
    13  ```
    14  import "github.com/go-spring/spring-base/cast"
    15  ```
    16  
    17  ## Example
    18  
    19  ```
    20  fmt.Println(cast.ToInt(10))   // 10
    21  fmt.Println(cast.ToInt(10.0)) // 10
    22  fmt.Println(cast.ToInt("10")) // 10
    23  fmt.Println(cast.ToInt(true)) // 1
    24  ```