KitzKikz  KitzKikz: CodeSnip   RecentChanges 
 PopularPages 
 SearchPages 
 Home | Trail - CodeSnip
 
 

Just temporarily storing some code examples:

- (NSArray *)tokensSeparatedByCharactersFromSet?:(NSCharacterSet? *)separatorSet
{
  NSScanner      *scanner      = NSScanner scannerWithString:self?;
  NSCharacterSet? *tokenSet     = separatorSet invertedSet?;
  NSMutableArray? *tokens       = NSMutableArray array?;

  scanner setCharactersToBeSkipped:separatorSet?;

  while ([scanner isAtEnd])
  {
    NSString  *destination = NSString string?;

    if (scanner scanCharactersFromSet:tokenSet intoString:&destination?)
    {
      [tokens addObject:NSString stringWithString:destination?];
    }
  }

  return NSArray arrayWithArray:tokens?;
}

- (NSArray *)objCTokens
{
  NSMutableCharacterSet? *tokensSet = NSMutableCharacterSet alphanumericCharacterSet?;
  _:?;
  return [self tokensSeparatedByCharactersFromSet?:tokensSet invertedSet?];
}

-(NSString *)removeTabsAndReturns?
{
    NSMutableString? *outputString = NSMutableString string?;
    NSCharacterSet? *charSet;
    NSString *temp;

    NSScanner *scanner = NSScanner scannerWithString:self?;

    charSet = \n\r\t?;

    while (scanner scanUpToCharactersFromSet:charSet intoString:&temp?)
      {
        outputString appendString:temp?;

      }
    return [outputString copy? autorelease];
}

 

   

 
 EditThisPage · LinksToPage · PageInfo 01/07/06 19:28:11  ·  0.0783s