From 575ec50cd001b6164e12ba4f09d1264759dac523 Mon Sep 17 00:00:00 2001 From: kauri Date: Sat, 18 Sep 2021 22:09:49 +0300 Subject: [PATCH] final - last char included #05 --- main.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 408ef73..867172a 100644 --- a/main.go +++ b/main.go @@ -17,10 +17,12 @@ func main() { os.Exit(1) } - // fmt.Println(string(input_text)) + fmt.Println(string(input_text)) text_slice := SplitBySpace(string(input_text)) + fmt.Println(text_slice) + text_slice = FindHexBinArticles(text_slice) // convert nr systems text := RemoveDoubleSpaces(strings.Join(text_slice, " ")) // empty slice units removed @@ -31,12 +33,16 @@ func main() { next_slice := SplitBySpace(text) + // strings.Fields(sisesta_string) + next_slice = FindTriggers(next_slice) // upper lower capitalize output_text := RemoveDoubleSpaces(strings.Join(next_slice, " ")) // slice back to single string output_text = FixPunctuation(output_text) // final punctuation control + fmt.Println(string(output_text)) + output_text = FixApostrophes(output_text) // apostrophes being checked // fmt.Println(string(output_text)) @@ -113,8 +119,8 @@ func FixApostrophes(text string) string { } } } + // fmt.Println(runes[(len(runes) - 1)]) } - text = "" for _, char := range runes { text += string(char) @@ -193,7 +199,7 @@ func SplitBySpace(text string) []string { for i, char := range text { - if string(char) != separator { + if string(char) != separator && i != len(text)-1 { str_temp += string(char) } else if str_temp == "(low," || str_temp == "(up," || str_temp == "(cap," { str_temp += string(char) @@ -202,9 +208,11 @@ func SplitBySpace(text string) []string { text_slice = append(text_slice, str_temp) str_temp = "" } + if i == len(text)-1 { text_slice = append(text_slice, str_temp) } + } return text_slice }