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 9234699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:51:03+00:00 2026-06-18T06:51:03+00:00

Possible Duplicate: How to convert an NSString into an NSNumber How can I convert

  • 0

Possible Duplicate:
How to convert an NSString into an NSNumber

How can I convert an NSString (@”Five” for example) into an NSNumber (5). I have looked to see if any questions answer this on Stack Overflow, but it seems that many people have been asking for a number to string conversion – not the other way around.

  • 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-18T06:51:04+00:00Added an answer on June 18, 2026 at 6:51 am

    This works roughly and should at least get you started:

    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    formatter.numberStyle = NSNumberFormatterSpellOutStyle;
    
    NSArray *testStrings = @[@"Five",@"twenty-four",@"Nineteen",@"One hundred forty-two"];
    
    for (NSString *test in testStrings) {
    
        NSNumber *result = [formatter numberFromString:[test lowercaseString]];
    
        NSLog (@"String %@ -> %@ as number",test,result);
    
    }
    

    Some things to think about:

    • You’ll want to set the locale correctly to either some fixed locale (if these strings are all coming from a server or something in one constant language) or let it float to the user’s locale (if the user is the one entering the strings)
    • As others have pointed out, this parser may not be sophisticated enough for your needs. For example, the last string “thirty three” actually returns the wrong result. The others work correctly. As @JonathanGrynspan suggested, if you tell us more about your goal here, someone can maybe suggest something better.

    I hope that helps.

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

Sidebar

Related Questions

Possible Duplicate: How can I convert a string to boolean in JavaScript? I have
Possible Duplicate: Convert NSDate to NSString convert string to nsdate Currently I have this
Possible Duplicate: Convert from char* to NSString? I have char myChar = 'r' How
Possible Duplicate: Convert ArrayList into 2D array containing varying lengths of arrays How can
Possible Duplicate: How to convert NSNumber to NSString Segue to pass string from MainViewController
Possible Duplicate: Convert NSArray to NSString in Objective-C I have an array of an
Possible Duplicate: Convert a datetime.date object into a datetime.datetime object with zeros for any
Possible Duplicate: Convert multidimensional array into single array I have this array: Array (
Possible Duplicate: How to convert MDB to SQLite in Android I have an MS
Possible Duplicate: How to convert List<Integer> to int[] in Java? I have an ArrayList

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.