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

  • Home
  • SEARCH
  • 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 6763301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:27:35+00:00 2026-05-26T14:27:35+00:00

I am communicating with a measurement isntrument and it returns the data in a

  • 0

I am communicating with a measurement isntrument and it returns the data in a single string. The output is like:

string result = "-3.546714E-10A,+0.000000E+00,+5.120000E+02\n";

So what I am interested to get in this string is first and second part. First part is Current in Ampere, and second is TimeStamp (measurement time).

I am trying this code but it does not work:

temp = result.Split(',');

tipair = new Results.TIPair();
tipair.Current = float.Parse(temp[0]);
tipair.Time = float.Parse(temp[1]);

Ideally I want it to be -3.546714E-10 for current and 0 for time (time be any positive number).

UPDATE: I tried to do like below but I get very bad numbers (much bigger than they should be!)

temp = result.Split(',');

tipair = new Results.TIPair();
tipair.Current = float.Parse(temp[0].Substring(0, temp[0].Length - 1));
tipair.Time = float.Parse(temp[1]);
  • 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-26T14:27:35+00:00Added an answer on May 26, 2026 at 2:27 pm

    You can parse current using Double.Parse() and valid Number Styles:

    string result = "-3.546714E-10A,+0.000000E+00,+5.120000E+02\n";
    var parts = result.Split(',');
    
    double current = double.Parse(parts[0].Remove(parts[0].Length - 1),
                            NumberStyles.AllowExponent | NumberStyles.Number);
    double time = double.Parse(parts[1],
                            NumberStyles.AllowExponent | NumberStyles.Number);
    

    MSDN, NumberStyles Enumeration:

    AllowExponent Indicates that the numeric string can be in exponential notation. The AllowExponent flag allows the parsed string
    to contain an exponent that begins with the “E” or “e” character and
    that is followed by an optional positive or negative sign and an
    integer. In other words, it successfully parses strings in the form
    nnnExx, nnnE+xx, and nnnE-xx. It does not allow a decimal separator or
    sign in the significand or mantissa; to allow these elements in the
    string to be parsed, use the AllowDecimalPoint and AllowLeadingSign
    flags, or use a composite style that includes these individual flags.

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

Sidebar

Related Questions

Im interested in communicating from a ruby on rails app with a flex app.
I am communicating with a server who needs null terminated string How can I
I'm communicating from a flash application using a command like the following: ExternalInterface.call(hello, world)
I have an Activity communicating with and directly accessing a background Service's data members
I'm communicating data between devices, and I have to program the protocol as an
In my Android app I am communicating with a web service the data sent
Communicating between two threads, I use a Message, transporting the data. In my case,
Two separate processes are communicating via JMS over MQ. The writer sets a string
I am communicating with some device and this device sending me data as unsigned
When I am communicating with my backend I often have URL like this: http://myserver.com/api/endpoint?param1={PARAM1}&param2={PARAM2}

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.