MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / isNumericColumn

Method isNumericColumn

src/csvtable.cpp:878–893  ·  view source on GitHub ↗

* Returns true, when the given column contains only numeric values. * Tests up to maxNum cells or all, if maxNum == 0 */

Source from the content-addressed store, hash-verified

876 * Tests up to maxNum cells or all, if maxNum == 0
877 */
878bool CsvTable::isNumericColumn(table_index_t col, table_index_t maxNum) {
879 if( col < 0 || col >= getNumberCols() ) {
880 return false;
881 }
882 if( maxNum == 0 || maxNum > getNumberRows() ) {
883 maxNum = getNumberRows();
884 }
885 bool ret = true;
886 for( table_index_t r = 0; r < maxNum; ++r ) {
887 if( !Helper::isNumber( getCell(r,col) ) ) {
888 ret = false;
889 break;
890 }
891 }
892 return ret;
893}
894
895
896

Callers 1

sortMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected