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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:11:11+00:00 2026-06-18T02:11:11+00:00

I have a line like this: 114765 * 3 * 659300 * 01 *

  • 0

I have a line like this:

114765 * 3 * 659300 * 01 * 17/01/2013 * * 1 * Chuck Norris * Chuck Norris Jr* Owner * 1 * 28/04/1983 * Conjuge * * * 16/1/2013 * 1 * Quadro Social *

As you can see, the content/fields are separted by * they are fields like matriculation, name, dependent's name, category etc… I’d like to know how could I ´read` it, one by one ?

Also I need to reorder this and write a new file.txt, with these content reordered and without the *… I’m totally lost !
After I read it and remove the * I need to replace them like \field\:
\114765\\3\\659300\\01\\17/01/2013\\1\\Chuck Norris\
I tried substring() and StreamWriter StreamReader ReadLine but I couldn’t do what I need ;\

  • 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-18T02:11:12+00:00Added an answer on June 18, 2026 at 2:11 am

    Use String.Split to get a string[] of the columns. You can use String.Join to join all parts together to a new string and File.WriteAlltext or File.WriteAllLines to write it back.

    After I read it and remove the * I need to replace them like \field\:

    So you need to replace the * with \:

    string[] parts = line.Split(new[] { '*' }, StringSplitOptions.RemoveEmptyEntries);
    string newLine = string.Join("", parts.Select(p => string.Format("\\{0}\\", p.Trim())));
    File.WriteAllText(filePath, newLine);
    

    Demo

    Result:

    \114765\\3\\659300\\01\\17/01/2013\\\\1\\Chuck Norris\\Chuck Norris Jr\\Owner\\1\\28/04/1983\\Conjuge\\\\\\16/1/2013\\1\\Quadro Social\\\
    

    Update:

    If you want to ignore parts that are empty(caused by two consecutive * * in the string), then you can use this code:

    var nonEmptyParts = parts
        .Where(p => !string.IsNullOrWhiteSpace(p))
        .Select(p => string.Format("\\{0}\\", p.Trim()));
    string newLine = string.Join("", nonEmptyParts);
    

    That’ll result in:

    \114765\\3\\659300\\01\\17/01/2013\\1\\Chuck Norris\\Chuck Norris Jr\\Owner\\1\\28/04/1983\\Conjuge\\16/1/2013\\1\\Quadro Social\
    

    I’d want to ignore the first 2 strings of the array, you know just
    remove it, throw it away

    That is Enumerable.Skip:

    var nonEmptyParts = parts.Skip(2)
        .Where(p => !string.IsNullOrWhiteSpace(p))
        .Select(p => string.Format("\\{0}\\", p.Trim()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a line like this: pick 22086f5 do something.... I can
I have a line like this: foobar as you can see there are many
Say I have a feature line like this: And I fill in Category with
I have a file that might contain a line like this. A B //Seperated
In my web app I have a line which looks like this: small textbox
I have a line of php code that looks like this: echo <script>$('#edit_errors').html('<h3><em>Please Correct
I have one line in php file like this: <a class=hide-if-no-js onclick=findPosts.open( 'media[]','<?php echo
I have a line like below. fullname = (this is a test name); I
I have a line in my SQL Stored Procedure that looks like this (works
if I have a text file like this : this is line one This

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.