datatype check
-
Hi, Guys I need to get data type for the streams that I read into the memroy. Assumption is that we don't know anything about file.(we do know deliminator, which in this case is '#') for example input files is as follows name#money#loanNumber Joe#10000#L01 Amy#2000#L05 Tom#12000#L11 As you see, column name and loadNumber is type of string, and money is integer. However, how do I decide in my c# program? should I make compare set of {'0', ..., '9'} and compare one by one for all the characters? Or is there any other way to decide these data type. Thanks guys!
-
Hi, Guys I need to get data type for the streams that I read into the memroy. Assumption is that we don't know anything about file.(we do know deliminator, which in this case is '#') for example input files is as follows name#money#loanNumber Joe#10000#L01 Amy#2000#L05 Tom#12000#L11 As you see, column name and loadNumber is type of string, and money is integer. However, how do I decide in my c# program? should I make compare set of {'0', ..., '9'} and compare one by one for all the characters? Or is there any other way to decide these data type. Thanks guys!
- Read one line - Parse that line for '#' - Split the line into its substrings - Analyze any substring, using String.IndexOfAny( "ABCDEFG..." ) - If index found, it is a string; else, it is an integer
-
- Read one line - Parse that line for '#' - Split the line into its substrings - Analyze any substring, using String.IndexOfAny( "ABCDEFG..." ) - If index found, it is a string; else, it is an integer