I have a log-file, example:
000124 14:44:54:370 Text IO Text Text Text
text text text
text text text
000125 14:44:54:370 Text IO Text Text Text text text text
texttext
000126 14:44:54:370 Text IO Text Text Text
I split this text into an array using this code:
let path = NSBundle.mainBundle().pathForResource("log file", ofType: "log")
var text = String(contentsOfFile: path!, encoding: NSUTF8StringEncoding, error: nil)!
var textArr = text.componentsSeparatedByString("\r\n0")
var lines = textArr.count
But sometimes the log-file gets very big and this happens:
099999 14:44:54:370 Text IO Text Text Text
text text text
text text text
100000 14:44:54:370 Text IO Text Text Text
100001 14:44:54:370 Text IO Text Text Text
What I would like to do is to have a code that does something like this:
var textArr = text.componentsSeparatedByString("\r\n0" OR "\r\n1")
Would it be possible? Or any other solutions for my problem?