So, again, I was able to finish this project but the Option Challenge is hanging me up. The GitHub solution does not address the Optional Challenge so that is no help. ( I made an edit suggestion to the owner, I don’t know if they will do anything though.)
Anyways, my question is how to I make an Array (print) into a String? I did Google this question and looked around but I think the nature of the code for this particular project does not lend itself to the found solutions:
let stringArray = ["Bob", "Dan", "Bryan"]
let string = **stringArray.joined(separator: "")**
print(string) // prints: "BobDanBryan"
The code is below is the solution to the project:
var alphabet: [Character] = [“a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”, “i”, “j”, “k”, “l”, “m”, “n”, “o”, “p”, “q”, “r”, “s”, “t”, “u”, “v”, “w”, “x”, “y”, “z”]
var secrectMessage = “HELLO”.lowercased()
var message = Array(secrectMessage)
for i in 0 …< message.count {
for j in 0 …< alphabet.count {
if message[i] == alphabet[j] {
message[i] = alphabet[(j+3)%26]
break
}
}
}
print(message)
How do I make the Array message print as a String?
FYI, not loving Arrays and Sets while learning coding/Swift. Did you all feel the same way?