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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:00:52+00:00 2026-06-10T07:00:52+00:00

I have the data table that is read from csv file. Then it is

  • 0

I have the data table that is read from csv file. Then it is iterated through row and columns, and each value is appended before writing to the file that is also destination csv file. I want to separate the data of one column upon the special character (“/”), into two columns. For example, the column of ‘Type’ of data table is “women/shoes and handbags/guess”. I have another column ‘SubType’, so I want to separate one column to two columns in data table before writing. I just want to ignore third type that is guess. Is there a way to seek position “/” and after second “/”, I want to insert that value into another column of data table that is ‘SubType’.

    foreach (DataRow dRow in dtSor.Rows)
    {
        for (int i = 0; i < dtSor.Columns.Count; i++)
        {
            if (dRow[i].ToString().Contains(","))
            {
                dest_csv.Append("\"" + dRow[i].ToString() + "\"" + ",");
            }

            else if (dRow[i].ToString() == "")
            {
                dest_csv.Append("NULL" + ",");
            }

            else
            {
                dest_csv.Append(dRow[i].ToString() + ",");
                //dest_csv.Append(dRow[i].ToString());
            }

        }

        dest_csv.Remove(dest_csv.Length - 1, 1);
        dest_csv.Append(Environment.NewLine);
    }

    File.WriteAllText(destination_file, dest_csv.ToString(), Encoding.Default);
}
  • 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-10T07:00:53+00:00Added an answer on June 10, 2026 at 7:00 am

    First check if the special char is in the field with indexOf, then split the field on the special char in an araay and take only the parts you’re intereseted in.

    like so:

    const char special = '\\';
    
    string maintype ="";
    string subtype ="";
    
    string field = dRow[i].ToString();
    if (field.IndexOf(special)>-1)
    {
      string[] splitted = field.Split(special);
      maintype = splitted[0];
      subtype = splitted[1];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the data table from the jquery plugin dataTables (http://datatables.net/) that I want
I have table that I insert data with following query (from c# code): INSERT
I basically have a table with headers that I read in from a DB
I have a program that should read from a file.It reads some amount of
I have some data in a table that looks roughly like the following: table
I have a data.frame and I'm trying to create a frequency table that shows
I have table of data that is sorted as follows: Item | Sample |
I have a table that stores data that has been entered regarding the amount
I have a table that contains all the data about users . Users can
I have a table that has data like below(sorted by date) COL_A | COL_B

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.