1

PDFファイルで文字列のバイト位置を見つけようとしましたが、真の値がわかりません

NSString *string2 = [NSString stringWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"test" ofType:@"pdf"]];

    int count =0;
    int ref=0;
    int gh=0;

// array contains all the line in th epdf
 NSArray *array = [string2 componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];

    for ( NSString *libe in array) {

        ref++;



         count=count+[libe lengthOfBytesUsingEncoding:NSUTF8StringEncoding];

 if ([@"my string" isEqualToString:libe])
        {



            id objet1 = [array objectAtIndex:ref];

            NSString *val1=(NSString*)objet1;


            NSRange range = [val1 rangeOfString:@"mystring" options:NSBackwardsSearch];
total =count+range.location;

}

}
4

0 に答える 0