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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:30:40+00:00 2026-05-24T03:30:40+00:00

I have a RTB that is loaded with a file that looks like this:

  • 0

I have a RTB that is loaded with a file that looks like this:

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    
U3      IC-00276G   236.135  198.644  90   BGA48     
U12     IC-00270G   250.610  201.594  0    SOP8      
J1      INT-00112G  269.665  179.894  180  SOIC16    
J2      INT-00112G  269.665  198.144  180  SOIC16    

I want to remove the last column using the string.Split() method.

So far I have:

// Splits the lines in the rich text boxes
string[] lines = richTextBox2.Text.Split('\n');

foreach (var newLine in lines)
{
     newLine.Split(' ');
     line = line[0] + line[1] + line[2] + line[3] + line[4];  #This is the code that does not work.
}

However this does not work… does anyone know the problem and how to do this properly so the file looks like this?:

J6      INT-00113G  227.905  174.994  180      
J3      INT-00113G  227.905  203.244  180       
U13     EXCLUDES    242.210  181.294  180     
U3      IC-00276G   236.135  198.644  90      
U12     IC-00270G   250.610  201.594  0         
J1      INT-00112G  269.665  179.894  180     
J2      INT-00112G  269.665  198.144  180    

EDIT: I also think that I need to string.Split(' ') each line that is already split?

  • 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-24T03:30:41+00:00Added an answer on May 24, 2026 at 3:30 am

    This might work (untested):

    string[] lines = richTextBox2.Text.Split('\n');
    for( int i = 0; i < lines.Length; i ++ )
    {
        lines[i] = lines[i].Trim(); //remove white space
        lines[i] = lines[i].substring(0, lines[i].LastIndexOf(' ');
    }
    string masterLine = String.Join(Environment.NewLine, lines);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a RichTextBox that is loaded from a file containg: TEXT MORETEXT
I have a file I am bringing into a RTB. Let's say it looks
I have a handler consuming the keyDown event of a WinForms RTB, that has
I know that this question has been asked loads of times, but I have
Have some dates in my local Oracle 11g database that are in this format:
This is my first tryst with C#. The form that i have in mind
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have some ascii files that are 60-100MB in size. I want to store
I have a custom control inherited from RichTextBox. This control has the ability to
I'm pondering creating a WPF or Silverlight app that acts just like a terminal

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.