1. Technology
Send to a Friend via Email

Practical Examples

Practical examples of using the various String methods.

CSV Example: Complete Code
Complete code for the "CSV Example" series.

CSV Example: Parsing CSV
A crash course on what CSV is, what it is used for and how it is parsed. A method for parsing CSV files using only Ruby's built-in string methods is presented and discussed.

CSV Example: Sorting and Column Widths
Once data has been parsed from CSV, the rows must be sorted and to prepare for formatting in an ASCII table, the column widths are calculated.

CSV Example: Format Strings and Printing the ASCII Table
Now that all the data has been parsed from the CSV and sorted, it's time to print out the ASCII table. Format strings are used to print the data while staying in the lines, and a few tricks are used to make the ASCII table a bit more pretty.

You can opt-out at any time. Please refer to our privacy policy for contact information.

©2014 About.com. All rights reserved.