Tags
Language
Tags
April 2024
Su Mo Tu We Th Fr Sa
31 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 1 2 3 4

A Beginner's Guide to C-Sharp-CH13: Parsing Tab and CSV Files (ABGC)

Posted By: AlenMiler
A Beginner's Guide to C-Sharp-CH13: Parsing Tab and CSV Files (ABGC)

A Beginner's Guide to C-Sharp-CH13: Parsing Tab and CSV Files (ABGC) by Tim R. Wolf
English | 17 Jun. 2017 | ASIN: B072SDQTPX | 87 Pages | PDF | 2.23 MB

Chapter 13 (81 pages) Parsing TAB, CSV and Delimited lines. This chapter describes how to take-a-part a delimited file, typically a CSV, and retrieving each found value into a separate variable or cell. C-Sharp has a dedicated "Split" method for this task, but it does not properly process most files that I have seen - it lacks many features.

In this chapter, you will write your own general-purpose Split command that works around various problems. The resulting program can be placed into a general-purpose utility library and can be used in any program. This routine is what I call "robust."

Topics: Manually parsing a line; starting a search-index at -1, for-next loops with a known number of columns; shifting delimiters within a loop; last-field logic. Tab-delimited files; tabular data with an unknown number of columns; variable columns. Error processing, blank lines, etc.

Additionally, these new utilities can be added to your library – and these utilities are amazing!
Basic Phone Number Parsing and Formatting (see also Chapter 21)
CL870-ParseCSVLine - general-purpose module that can parse any line, with any delimiter.

About this series: A beginner's guide to C-Sharp programming with Microsoft's Visual Studio, 2017. A complete programming guide. Simple, step-by-step, fully illustrated. Tailored for new and novice developers. Discusses basic techniques that all programmers need to learn.

This series is sold by Chapters at a low cost. A total of 28 chapters, in three volumes. Over 1800 pages, 900 quality illustrations.

Why am I distributing by chapter? To keep the cost down and to keep each section manageable. This book acts as a reference guide. Topics are covered in great detail, with little time spent on theory. The goal of these books are to solve programming problems quickly and efficiently.

I hope you enjoy reading and studying these pages as much as I have enjoyed writing them. –TRW