Skip to content

Instantly share code, notes, and snippets.

@clone1018
Created November 11, 2013 16:11
Show Gist options
  • Save clone1018/7415712 to your computer and use it in GitHub Desktop.
Save clone1018/7415712 to your computer and use it in GitHub Desktop.
// htmlcolor project main.go
package main
import (
"fmt"
"log"
"os"
"regexp"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("Please input something.")
return
}
input := os.Args[1]
color := findColor(input)
fmt.Println(color)
}
func findColor(input string) string {
validHex, err := regexp.Compile("[^0-9A-F]")
if err != nil {
log.Fatal(err)
}
safe := validHex.ReplaceAllString(input, "0")
for len(safe)%3 != 0 {
safe = safe . "0"
}
length := len(safe)
chunks = chunkString(safe)
// replacement
return safe
}
func chunkString(input string, chunkLen = 3 int) {
strLen := len(input)
for(int M=3; M < 14; ++M) {
at := 0
pre := i
// fuck this and fuck you
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment