| 16800 | |
| 16801 | |
| 16802 | BOOL VarToBOOL(Var &aVar) |
| 16803 | { |
| 16804 | if (!aVar.HasContents()) // Must be checked first because otherwise IsNumeric() would consider "" to be non-numeric and thus TRUE. For performance, it also exploits the binary number cache. |
| 16805 | return FALSE; |
| 16806 | switch (aVar.IsNumeric()) |
| 16807 | { |
| 16808 | case PURE_INTEGER: |
| 16809 | return aVar.ToInt64() != 0; |
| 16810 | case PURE_FLOAT: |
| 16811 | return aVar.ToDouble() != 0.0; |
| 16812 | default: |
| 16813 | // Even a string containing all whitespace would be considered non-numeric since it's a non-blank string |
| 16814 | // that isn't equal to 0. |
| 16815 | return TRUE; |
| 16816 | } |
| 16817 | } |
| 16818 | |
| 16819 | |
| 16820 |
no test coverage detected