Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you have a long text file to parse, the framework classes will take long time. You can't change that. And you can't change that they will never call back during work to tell you about their progress.</p> <p>Your only chance is to perform text file splitting on your own and set your progress as you dig yourself through your textfile. You can split a textfile with regular expressions. The "\w+" collect words with at least one character.</p> <p>If you set the progress bar in a heavy working method you have to give it some time to refresh the screen once in a while. See the "futuredate magic" below.</p> <p>Maybe the following can act as a starting point - in the code below the content of the text file is stored in the NSString "content".</p> <pre><code>NSError *error = NULL; NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\w+" options:NSRegularExpressionCaseInsensitive error:&amp;error]; [regex enumerateMatchesInString:content options:0 range:NSMakeRange(0, [content length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){ // push one match to the dictionary [dictionary addObject:[content substringWithRange:match.range]]; // update the progress bar NSDate* futureDate = [NSDate dateWithTimeInterval:0.001 sinceDate:[NSDate date]]; [[NSRunLoop currentRunLoop] runUntilDate:futureDate]; self.progressbar.progress = (float) match.range.location/content.length; }]; </code></pre> <p>Note that the code is not optimized for speed. For example you should not update the progress bar with <em>every</em> token. Depending on how much tokens you have - count the detected ones and update the pgogress bar every 100 matches, or so...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload