-
Notifications
You must be signed in to change notification settings - Fork 0
/
csvcompare.go
61 lines (48 loc) · 945 Bytes
/
csvcompare.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
)
func main() {
sampleString := "Immanuel1234"
file, err := os.Open("names.txt")
if err != nil {
log.Fatalf("failed opening file: %s", err)
}
scanner := bufio.NewScanner(file)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
// if compareOperators(sampleString, scanner.Text()) {
// if compareString(sampleString, scanner.Text()) {
if compareEF(sampleString, scanner.Text()) {
fmt.Printf("We found a match!")
}
}
file.Close()
}
/*
func compareString(a string, b string) bool {
if strings.Compare(strings.ToLower(a), strings.ToLower(b)) == 0 {
return true
}
return false
}
*/
func compareEF(a string, b string) bool {
if strings.EqualFold(a, b) {
return true
}
return false
}
/*
func compareOperators(a string, b string) bool {
// compare with operators
if strings.ToLower(a) == strings.ToLower(b) {
return true
}
return false
}
*/