Using DDMathStringTokenizer
, while something like 2 + 4
tokenizes fine into 3 tokens (with the second being the + operator and the first and third being numbers), if I pass over a +
alone, it fails to return it as a token.
This does not hold true for every other operator I've tried, such as /
*
-
etc.
I can probably force this somehow but how can I get DDMathStringTokenizer
to tokenize the +
correctly?
To reproduce the issue:
The following will return an array with no objects. If you change the string
value to another operator character it will return a valid array.
NSError *error = nil;
NSString *string = @"+";
DDMathOperatorSet *opSet = [DDMathOperatorSet defaultOperatorSet];
DDMathStringTokenizer *tokenizer = [[DDMathStringTokenizer alloc] initWithString:string operatorSet:opSet error:&error];
NSLog(@"Tokens:%@", [tokenizer allObjects]);