This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<string>//Tiny CSV pretty-print | |
#include<vector>//Matthew Chandler | |
#include<cstdio>//mattvchandler@gmail | |
#define E feof(f)//©2019 by MIT license | |
#define G c=getc(f);//build w/ c++17 | |
#define Z size()//./tinycsv foo.csv | |
using namespace std;using I=int;using S= | |
string;pair<S,I>p(FILE*f){I q=0,c;S w; | |
while(1){G if(c==EOF&&!E)throw 0;if(c== | |
'"'){if(q){G if(c==','||c=='\n'||c=='\r' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// title_case.c | |
// Attempt at proper title casing algorithm | |
// The basic method is to 1st load a dictionary of exceptions | |
// when given a string, we will look up each word in the dictionary. | |
// If found, we will use the capitalization from the dictionary file | |
// otherwise, all words start with a capitals, and the rest are lowercase | |
// the 1st letter of the 1st and last words in the string are always capitalized | |
// only works for ascii text |