Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9220565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:22:45+00:00 2026-06-18T03:22:45+00:00

I am building a calculator app for iOS using DDMathParser. I would like to

  • 0

I am building a calculator app for iOS using DDMathParser. I would like to know how to separate an expression (NSString) like 5+900/32 into its individual number values: 5, 900, and 32. I would prefer that I get these in an NSArray or other relatively useful list object. I have heard that there is an easy way to do this with DDMathParser – It’s why I switched from GCMathParser.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:22:47+00:00Added an answer on June 18, 2026 at 3:22 am

    DDMathParser author here.

    Yes, this is very easy, and there are a couple of ways to go about it. If you simply want what the numbers are and don’t care about the operators, you can use the tokenizing API:

    NSError *tokenizingError = nil;
    DDMathStringTokenizer *tokenizer = [DDMathStringTokenizer tokenizerWithString:@"5+900/32" error:&tokenizingError];
    NSArray *tokens = [tokenizer tokens];
    
    NSMutableArray *numbers = [NSMutableArray array];
    for (DDMathStringToken *token in tokens) {
      if ([token tokenType] == DDTokenTypeNumber) {
        [numbers addObject:[token numberValue]];
      }
    }
    
    // numbers now is @[ @5, @900, @32 ];
    

    There is, however, a caveat to this approach, and it can be best illustrated with this example: @"-42". Tokens in DDMathParser are always parsed as unsigned numbers, because the minus sign in front is actually an operator and gets applied differently depending on other operators. That means that if you tokenize the string @"-42", you’ll see that it contains two tokens: a negation operator, and the number 42.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client who would like the app we are building to show
I am currently building an Iphone app that is using storyboards. I know how
I am building an html5 calculator that looks like <form onsubmit=return false oninput=o.value =
So I have this calculator I'm building that accepts user variable inputs like let
We are building an application on Google App Engine in Java using Spring 2.5.
I have one C code app. which i was building using MS-VS2005. I had
I'm building my own iOS framework using this package: https://github.com/kstenerud/iOS-Universal-Framework This may be a
I am building an ios ipad app and I have the following formula in
I'm building a basic calculator app for iPhone. I've got all the basics in
I'm building an app that would analyze phone's motion through accelerometer and gyroscope output.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.