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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:37:43+00:00 2026-05-27T00:37:43+00:00

I am trying to write a method that converts from engineering notation to double

  • 0

I am trying to write a method that converts from engineering notation to double. The case I have now is very special! I mean I am not going to look for powers like “Mega, Giga and …” I am just looking for floating points.

Some valid examples of my Case are:

1.0 A should be 1

1.0064 mA or 1.0064 Ma should be 0.0010064 Note that I count both M and m as mili…that can be achived using ToLower() method. and that A or a counts as Ampere for current.

I have the same case for Voltage, so in that user can enter V or v instead.

again some valid cases:
256ma 366 m a 10.665 uA

So at the end before I pass this string to my converting method, I do text.ToLower().Remove(" ", string.Empty); this will hopefully leave me with a easy string to work on.

Now the second step is to split numbers from characters:
10.665ua should result in 10.665 and ua so then I can check for first character of ua against a list of allowed strings and find the power factor.

private List<string> AllowedCurrentStrings = new List<string>() { "a", "ma", "m", "ua", "u", "na", "n", "pa", "p" };

So I am looking for your help. first I need to know how to split numbers from characters and then group the characters into a string (Or do I need to do the later one?)

Or if you think my approach is not good, it would be nice to hear a better one from you!

  • 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-05-27T00:37:43+00:00Added an answer on May 27, 2026 at 12:37 am

    You could try this:

        public double ConvertMeasure(string measure)
        {
            measure = measure.ToLower().Replace(" ", "");
            measure = measure.Substring(0, measure.Length - 1);
            char m = measure.Last();
            if (char.IsDigit(m))
                return double.Parse(measure, CultureInfo.InvariantCulture);
    
            double ret = double.Parse(measure.Substring(0, measure.Length - 1),
                                      CultureInfo.InvariantCulture);
            switch (m)
            {
                case 'm': return ret / 1E3;
                case 'u': return ret / 1E6;
                case 'n': return ret / 1E9;
                case 'p': return ret / 1E12;
            }
            return ret;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a generic Parse method that converts and returns a
I'm trying to write some C# code that calls a method from an unmanaged
I'm trying to write a method that acts as a setter and takes some
I am trying to write an Audit Log method that will log all changes
I'm trying to write (or just find an existing) PHP method that can take
I'm trying to write an extension method for objects that will dump the structure
I am trying to write a method, that takes a ComboBox, a DataTable and
I'm trying to write a method which takes a Map[K, Collection[V]] and converts it
I am trying to write a method that takes in an Object[] that is
I have an application that's built on top of Eventlet. I'm trying to write

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.