I am trying to take an array and split it into an array of strings, this is my code:
if split != "" {
for i := 0; i < len(split); i++ {
for j := 0; j < len(split); j += 0 {
splits := []byte(split)
if splits[i] == ' ' {
result := split[i] - split[j]
for k := 0; k <= i; k++ {
fitting := make([]byte, result)
fitting[k] = splits[k]
fmt.Println(fitting[k])
if k > i-1 {
fittings := string(fitting[:])
word := []string{}
words := append(word, fittings)
fmt.Println(split, words)
}
}
}
}
}
}
return Strings(split)
and this is my test case:
fmt.Println(actual, expected)
for i := 0; i < len(expected); i++ {
if actual[i] != expected[i] {
t.Errorf("does not match")
t.Fail()
}
}
}
None of it is really working.