* Returns true, when the given column contains only numeric values. * Tests up to maxNum cells or all, if maxNum == 0 */
| 876 | * Tests up to maxNum cells or all, if maxNum == 0 |
| 877 | */ |
| 878 | bool 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 |