What method do I call to find the number of spaces in a string in Swift? I want to loop through that number, something like this:
@IBOutlet weak var stack: UILabel!
@IBOutlet weak var plus: UIButton!
@IBAction func sum(sender: AnyObject) {
var stackTitle = stack.text
var numberOfSpaces = stackTitle!.CanICallSomethingHereToHelp:)
var i:Int
for i = 1; i < numberOfSpaces; ++i{
operate(plus)
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…