0

I'm looking to get tokens back from a string (to aid in editing) and referring to the answer here iOS DDMathParser Get Number 'Blocks' it appears that this functionality may be deprecated. What is the most up-to-date way to get token objects from my string?

Community
  • 1
  • 1
joshd
  • 1,626
  • 14
  • 17

1 Answers1

0

Ok. So, this appears to be the current way of getting tokens from a string:

    NSError *error = nil;
    DDMathOperatorSet *opSet = [DDMathOperatorSet defaultOperatorSet];
    DDMathStringTokenizer *tokenizer = [[DDMathStringTokenizer alloc] initWithString:@"123+142-3/51815*(-5+2.0)" operatorSet:opSet error:&error];
    NSArray *tokens = [tokenizer allObjects];
joshd
  • 1,626
  • 14
  • 17