c# - Evaluate/Find column delimiter of a text file -


does have method of evaluating/finding column delimiter of given text file? i'm willing suggestions, whether involves c# script, powerscript, etc.

i have client likes keep on our feet changing column delimiters every other data feed. obviously, breaks our sql agent import jobs. while go failure route -- if connection manager (with comma delimiter instance) fails, use connection manager (tab delimited connection) -- rather evaluate delimiter before failure , decide route take. have experience doing this?

assuming each row has same number of columns, pick set of common delimiters (comma, tab, pipe, whatever) , count how many of each within first many rows. if comma counts first 5 rows 34,34,35,34,36 while tab count rows 0,0,1,0,0 have 34 comma-delimited columns, few commas embedded in text. it'll easier if know in advance how many columns expect.

bottom line may not deterministic, black-and-white algorithm, matter of choosing rules , thresholds based on data looks , having code make best guess.

that, or put smack down on client. :-)


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -