ios – Search RTF for Daring font in Obj-C


In my app I type by means of 1000’s of traces of inquiries to create a property listing file. As a part of this, I want it to detect which texts are in daring, as these are those marked as the right reply. It might be one thing like

1. What's 1+1?
A. 2
B. 3
C. 4
D. 5

And on this case, A. 2 could be BOLD. What I am having points with is detecting the daring textual content to simply load all the right solutions. What I’m making an attempt thus far returns completely nothing:

for (NSUInteger i = 0; i < answerOptions.rely; i++) {
              NSString *answerOption = answerOptions[i];
              
              NSRegularExpression *boldRegex = [NSRegularExpression regularExpressionWithPattern:@"<b>(.*?)</b>"
                                                                                         options:NSRegularExpressionCaseInsensitive
                                                                                           error:nil];
              NSArray *boldMatches = [boldRegex matchesInString:answerOption
                                                        options:0
                                                          range:NSMakeRange(0, answerOption.length)];
              
              if (boldMatches.rely > 0) {
                  correctAnswerIndex = [NSString stringWithFormat:@"%lu", i];
                  break;
              }
          }

On this state of affairs I’d count on correctAnswerIndex to offer me an NSString of “0”, however as an alternative I get nothing. Any concepts?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles