Skip to content

Commit 5a9c86f

Browse files
committed
clenaer
1 parent 2b53add commit 5a9c86f

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

c_to_f/vim

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
%s/#^\v(d\+\.*\d*) F$\=printf("%.1f C", (submatch(1)-32/1.8)#

f_to_c_go/fahrenheit

0 Bytes
Binary file not shown.

f_to_c_go/fahrenheit.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ func conform_line(line string) (string, error) {
1616
r := regexp.MustCompile(`^(\d{1,}\.?\d?) F`)
1717
fahrenheit_s := r.FindAllStringSubmatch(line, -1)
1818

19-
if len(fahrenheit_s) > 0 {
20-
fahrenheit, err := strconv.ParseFloat(fahrenheit_s[0][1], 64)
21-
if err != nil {
22-
return "", err
23-
}
24-
return fmt.Sprintf("%.1f C", convert_c_to_f(fahrenheit)), nil
25-
} else {
19+
if len(fahrenheit_s) == 0 {
2620
return line, nil
2721
}
22+
23+
fahrenheit, err := strconv.ParseFloat(fahrenheit_s[0][1], 64)
24+
if err != nil {
25+
return "", err
26+
}
27+
return fmt.Sprintf("%.1f C", convert_c_to_f(fahrenheit)), nil
2828
}
2929

3030
func main() {

palindromes/test.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
💩oo💩
2+
abba

0 commit comments

Comments
 (0)