Stylistic: "var s: [String] = []" => "var s = [String]()"
Added test case for str[range].