github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/data/hex/int.go (about)

     1  package hex
     2  
     3  import "strconv"
     4  
     5  // ParseInt decodes a hex string as a quantity.
     6  func ParseInt(s string) (int64, error) {
     7  	return strconv.ParseInt(s, 16, 64)
     8  }
     9  
    10  // ParseUint decodes a hex string as a quantity.
    11  func ParseUint(s string) (uint64, error) {
    12  	return strconv.ParseUint(s, 16, 64)
    13  }
    14  
    15  // FormatInt encodes i as a hex string.
    16  func FormatInt(i int64) string {
    17  	return strconv.FormatInt(i, 16)
    18  }
    19  
    20  // FormatUint encodes i as a hex string.
    21  func FormatUint(i uint64) string {
    22  	return strconv.FormatUint(i, 16)
    23  }