Now, I'm practicing the Swift Language.
I created a StringHelper
Class.
It saves a string in the str
property, and by using a method, it returns same string without whitespace.
class StringHelper {
let str:String
init(str:String) {
self.str = str
}
func removeSpace() -> String {
//how to code
}
}
let myStr = StringHelper(str: "hello swift")
myStr.removeSpace()//it should print 'helloswift'
I want to use only the Swift language... not the NSString
methods, because I'm just practicing using Swift.