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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:18:55+00:00 2026-06-03T13:18:55+00:00

I am trying to program a converter in iOS. The user enters values into

  • 0

I am trying to program a converter in iOS.

The user enters values into textfields, and the values are converted.

The results are finally given back to the user.

The output has to be in a locale decimal format, which works.

Also, the output has to be printed in exponent form, which works.

Problem: I need both exponent form and decimal form.

The following code explains what works.

//formatting

        NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];  
        [formatter setLocale:[NSLocale currentLocale]];
        [formatter setNumberStyle: NSNumberFormatterDecimalStyle];

//formattiing

        float myFloat=0.01;
        NSNumber *myNumber =[[NSNumber alloc]initWithFloat:myFloat];
        NSString *myString =[formatter stringFromNumber:myNumber];


        NSLog(@"Locale: %@", formatter.locale.localeIdentifier);
        NSLog(@"myFloat = %g", myFloat);
        NSLog(@"myNumber = %.2e",[myNumber floatValue]);
        NSLog(@"myString = %@", myString);

//output
 Locale: nb_NO
 myFloat = 0.01
 myNumber = 1.00e-02
 myString = 0,01

What does NOT work. I need exponent and decimalformatter in one!

I want this output:

myString = 1,00e-2

Anybody got a clue?

  • 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-03T13:18:56+00:00Added an answer on June 3, 2026 at 1:18 pm

    Try this with your formatter: NSNumberFormatterScientificStyle

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

Sidebar

Related Questions

I am trying to polish up a program a program that I have converted
I'm trying to develop a program that convert 6 bytes into a hexadecimal representation
I'm trying to convert an old Delphi program I wrote into Java to compile
I converted a program from IDL into CUDA that performs some calculations on a
I'm trying to use the command line program convert to take a PDF into
i am trying to write a program which inputs two numbers from user as
Here's the deal: I'm trying, as a learning experience, to convert a C program
I am currently trying to program my first ajax interface using Rails. The application
I'm trying to program ARM using Eclipse + CDT + yagarto (gnu toolchain) +
So I am trying to program a way to replay a tic tac toe

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.