Created
November 11, 2013 16:11
-
-
Save clone1018/7415712 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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