I'm extracting a number out of string of numbers in a character but unable either to convert that character to string or to int. Here is my code:
func processString(_ s: String) ->Bool { var sum = 0 for char in s{ let number = String(char){ //error Cannot invoke initializer for type 'String' with an argument list of type '(Character, () -> ())' } } } if I try to converted to Int:
func processString(_ s: String) ->Bool { var sum = 0 for char in s{ let number = Int(String(char)){ //Cannot invoke initializer for type 'Int' with an argument list of type '(String, () -> ())' } } } Any of you knows what I'm doing wrong or why can not convert the character to string or int?
I'll really appreciate your help.