07-19-2023, 12:53 AM
I know its noob question, i really search around before ask. But there is not exact answer of what i want to know.
How we split string into the array without using Objective C? For example:
var str = "Today is so hot"
var arr = str.componentsSeparatedByString(" ") // *
* I know it doesnt work but i am looking for like that. I want to split string with " " (or another char/string)
Idea:It might be very good for me, making extension of string class. But i dont know how i do that.
Edit: Forgetting import Foundation. If I import foundation it will work. But is there any way to do with extending String class?
Thank you
How we split string into the array without using Objective C? For example:
var str = "Today is so hot"
var arr = str.componentsSeparatedByString(" ") // *
* I know it doesnt work but i am looking for like that. I want to split string with " " (or another char/string)
Idea:It might be very good for me, making extension of string class. But i dont know how i do that.
Edit: Forgetting import Foundation. If I import foundation it will work. But is there any way to do with extending String class?
Thank you