I have a basic array that I'd like to manipulate. It seems that within the brackets of my if statement I can successfully manipulate the array (the right side of the screen shows that value has changed); however, once I leave the if statement, the changes seem to go away (the right side of the screen shows the original value, not the changed one). Thank you for your help!
var originalInfo = """
This
Is
A
Test
String
"""
// split string
var SplitInfo = originalInfo.split(separator: "\n")
// Manipulate Array
if SplitInfo[1].hasPrefix("I") == true {
SplitInfo[1].replacingOccurrences(of: "s", with: "s not")
}
SplitInfo[1]
Aucun commentaire:
Enregistrer un commentaire