Antcas Control can seamlessly convert numbers to strings and vice versa without any further effort. It is therefore easy to add two strings together, which may also contain characters other than numbers. The following rules apply:
If the string does not contain any of the characters ".", "e" or "E" and the numerical value is within the limits for integer types (as defined in INT_MAX) it will be evaluated as an integer. In all other cases, it will be evaluated as a float.
The value is specified by the initial section of the string. Spaces are ignored. If the string starts with valid numerical values, this value is used. Otherwise, the value is equal to 0. Valid numeric data consists of an optional sign followed by one or more digits (optionally including a decimal point), followed by an optional exponent. The exponent is an "e" or "E", followed by one or more digits.
| Calculation | Result |
|---|---|
| 1 + "10.5" | 11.5 |
| 1 + "-1.3e3" | -1'299 |
| 1 + "bob-1.3e3" | 1 |
| 1 + "bob3" | 1 |
| 1 + "10 Small Pigs" | 11 |
| 4 + " 10.2 Little Piggies" | 14.2 |
| "10.0 pigs " + 1 | 11 |
| " 10.2 pigs " + 1 | 11.2 |