Skip to content

Instantly share code, notes, and snippets.

@obscuren
Created May 28, 2014 10:55
Show Gist options
  • Save obscuren/f7ff89e0bcfef39f6a42 to your computer and use it in GitHub Desktop.
Save obscuren/f7ff89e0bcfef39f6a42 to your computer and use it in GitHub Desktop.
out := ethutil.StringToByteFunc(str, func(s string) (ret []byte) {
ret = doSomethingWith(s)
return
})
// ==
var out []byte
if s[0:2] == "0x" {
out = fromHex([2:])
} else {
out = doSomethingWith(s)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment