I would like to know how I can get several indexes within an array of strings or characters.
An example:
var arrayInput = ["2","+","3","(","2","-","4","(","3","*","5",")",")",]
func isParentheses() {
var count = 0
var arrayNumParentesis:Array<String> = []
for x in arrayInput {
if x == "(",
let index = arrayInput.index(of: x) {
let y = index
arrayNumParentesis.append(y)
print(arrayNumParentesis)
}
}
}
I try to enter the values of the position in the array of the parenthesis opening characters but as you can see, only the value of the first one is saved.
Thanks in advance.