Hi,
I can't understand why this fail
NSString* str=@"( 1.3.6.1.4.1.4980.1.3.3 NAME 'oxyInetDomain' DESC
'Oxymium Inet Domain' SUP oxyTop AUXILIARY MUST dc MAY ( admContact $
admincontact $ billingContact $ cn $ domainCreationDate $ labeledURL $
mailRelayedBy $ managerEMail $ nic $ nichandle $ registrant $ soa $
techContact $ domaindescription $ oxymiumReferenceDisplay $
associatedServices $ associatedrootentity $ associatedmanagemententity
$ associatedrootcompany $ associatedmanagemententityrights $
associatedrootentityrights $ associatedrootcompanyrights $ parkmessage
$ logoURL ) )";
NSScanner *aScanner = [NSScanner scannerWithString:str];
if (0) // If 1, it works !
{
BOOL upTo1=[aScanner scanUpToString:@"MUST "
intoString:NULL];
NSLog(@"upTo1=%d",upTo1);
if (upTo1)
{
BOOL scan1=[aScanner scanString:@"MUST "
intoString:NULL];
NSLog(@"scan1=%d",scan1);
if (scan1)
{
NSString* must=nil;
[aScanner scanUpToString:@" "
intoString:&must];
}
};
};
NSLog(@"scanLocation=%u",[aScanner scanLocation]);
NSLog(@"scan=[%@]",[[aScanner string]
substringFromIndex:[aScanner scanLocation]]);
BOOL upTo2=[aScanner scanUpToString:@"MAY "
intoString:NULL];
NSLog(@"upTo2=%d",upTo2);
if (upTo2)
{
BOOL scan2=[aScanner scanString:@"MAY "
intoString:NULL];
NSLog(@"scan2=%d",scan2);
};
I try to scan str for differents components. If I scan directly up to
MAY, it works. If I scan for must and next scan
for may, it doesn't works.
May be my code is wrong but I can't see why :-)