Skip to content

Instantly share code, notes, and snippets.

@hartfordfive
Created September 15, 2015 13:50
Show Gist options
  • Select an option

  • Save hartfordfive/1d44e04ac8f7f49a319d to your computer and use it in GitHub Desktop.

Select an option

Save hartfordfive/1d44e04ac8f7f49a319d to your computer and use it in GitHub Desktop.
Sample Go utility functions
func is_whitespace(ch rune) bool { return ch == ' ' || ch == '\t' || ch == '\n' }
func is_alpha(ch rune) bool { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') }
func is_numeric(ch rune) bool { return (ch >= '0' && ch <= '9') }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment