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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:20:43+00:00 2026-05-24T02:20:43+00:00

I have a question on why this is happening. First, I’ll explain what is

  • 0

I have a question on why this is happening. First, I’ll explain what is going on. I am finding a line in a RichTextBox and taking a Split value and replacing it with the same value but with a decimal limit. Here is what my file looks like:

J6   INT-00113G  227.905  174.994    180   SOIC8
J3   INT-00113G  227.905  203.244    180   SOIC8
U13  EXCLUDES    242.210  181.294    180   QFP128

BUT for some reason I am getting this when I try to replace and output it back out… (the numbers appear twice in both the 3rd and 4th columns)

J6   INT-00113G  227.91227.91   174.99174.99     180   SOIC8
J3   INT-00113G  227.91227.91   203.24203.24     180   SOIC8
U13  EXCLUDES    242.21242.21   181.29181.29     180   QFP128

AND HERE IS MY CODE… WHAT IS THE ERROR TO MAKE IT DO THIS?

string[] myLines = placementTwoRichTextBox.Text.Split('\n');
foreach (string line in myLines)
{
    // Matches the entire line.
    Match theMatch = Regex.Match(line, @".*");

    if (theMatch.Success)
    {
        // Stores the matched value in string output.
        string output = theMatch.Value;

        // Replaces tabs and extra space with only 1 space delimiter
        output = Regex.Replace(output, @"\s+", " ");

        // Splits the specified regex into two different regexs.
        var componentItem = output.Split(' ');

        double d1 = Convert.ToDouble(componentItem[2]);
        double d2 = Convert.ToDouble(componentItem[3]);
        double round1 = Math.Round(d1, 2, MidpointRounding.AwayFromZero);
        double round2 = Math.Round(d2, 2, MidpointRounding.AwayFromZero);

        componentItem[2] = Regex.Replace(componentItem[2], @".*", round1.ToString());
        componentItem[3] = Regex.Replace(componentItem[3], @".*", round2.ToString());

        // Sets the RichTextBox to the string output.
        newPl2ItemsRichTextBox.AppendText(componentItem[0] + "   " + componentItem[1] + "   " + componentItem[2] +
            "   " + componentItem[3] + "   " + componentItem[4] + "   " + componentItem[5] + "\n");
    }
}

Does anyone know why this is happening?

  • 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-24T02:20:44+00:00Added an answer on May 24, 2026 at 2:20 am

    Instead of doing all this, simply do your split, since you know index 2 and 3 contain your numbers… simply do something like:

    newPl2ItemsRichTextBox.AppendText(componentItem[0] + ” ” + componentItem[1] + ” ” + Math.Round(Convert.ToDouble(componentItem[2]), 2) + ” ” + Math.Round(Convert.ToDouble(componentItem[3]), 2) + ” ” + componentItem[4] + ” ” + componentItem[5] + “\n”);

    Avoid all the other steps, just split and print.

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

Sidebar

Related Questions

This is my first question on the site even though i have been coming
This question seems clear what is happening: I already have a connection open, the
I have tableview that scroll vertically. My question is when first this view is
I have this question: Does implementing a custom MembershipProvider class needs you to implement
I have this question in which I have a SQL Server Compact Edition database
I have this question because I am not familiar latest generation of MS VS
I have this question: How could I call a codebehind method from jquery? I
I have this question relating to Lucene. I have a form and I get
I have a question about this question . I posted a reply there but
I have a question concerning this code which I want to run on QNX:

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.