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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:36:24+00:00 2026-05-28T17:36:24+00:00

I have a log file. The file is structured. Each line is delimeted by

  • 0

I have a log file. The file is structured. Each line is delimeted by commas so that it looks like a table. I have to read from this file and transport the content to a database table. I want to treat the first 9 commas as delimeters and the rest ones as just a content of the tenth column. So, there can be more than 9 commas in a line but the tenth and the next ones shoudn’t be taken as a delimeter. I actually know how to do it by iterating through the characters and checking occurance of commas. But I don’t want it be inefficient. maybe there’s a better way? What would be the most accurate way to accomplish this? Either C# or Delphi is OK. For Oracle I’ll probably use Oracle but SQL Server is also an option.

  • 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-28T17:36:26+00:00Added an answer on May 28, 2026 at 5:36 pm

    The String.Split(char[],int) method overload achieves what you require. For example:

    string line = "a,b,c,d,e,f,g,h,i,j,k,l,m,n";
    string[] fields = line.Split(new char[] { ',' }, 10);
    

    The fields array will contain ten elements. The first nine elements correspond the first nine substrings of line that were delimited by ',' characters, whilst the last element would correspond to the remaining substring (following the ninth ',' occurrence).

    From MSDN (with count being the second argument passed to the Split(char[], int) method):

    If there are more than count substrings in this instance, the first count minus 1 substrings are returned in the first count minus 1 elements of the return value, and the remaining characters in this instance are returned in the last element of the return value.

    Thus, executing:

    for (int i = 0; i < fields.Length; ++i)
        Console.WriteLine(string.Format("fields[{0}]: \"{1}\"", i, fields[i]));
    

    would output:

    fields[0]: "a"
    fields[1]: "b"
    fields[2]: "c"
    fields[3]: "d"
    fields[4]: "e"
    fields[5]: "f"
    fields[6]: "g"
    fields[7]: "h"
    fields[8]: "i"
    fields[9]: "j,k,l,m,n"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a formatted string from a log file, which looks like: >>> a=test
I have a log file in SqlServer that stores the time an application started,
I have a log file containing statistics from different servers. I am separating the
I have a transaction log file in CSV format that I want use to
I have a data set representing data from a log file which shows users
I have an ASCII log file with some content I would like to extract.
I am building application that required some data from iPhone's Call log(read only). The
I currently have a log file(see bellow) that I need to iterate through and
i have a log file which contains hundreds/thousands of seperate XML messages and need
Advance New Year Wishes to All. I have an error log file with the

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.