EExcel 丞燕快速查詢2

EExcel 丞燕快速查詢2
EExcel 丞燕快速查詢2 https://sandk.ffbizs.com/

golang ethereum address regexp check

https://docs.etherniti.org/architecture/optimizations/address-validation/


package main

import (
    "fmt"
    "regexp"
)

var (
    re := regexp.MustCompile("^0x[0-9a-fA-F]{40}$")
)

func IsValidAddress(v string) bool {
    return re.MatchString(v)
}

func main() {
    fmt.Println(IsValidAddress("0x323b5d4c32345ced77393b3530b1eed0f346429d")) // true
    fmt.Println(IsValidAddress("0xXYZb5d4c32345ced77393b3530b1eed0f346429d")) // false
}