strval()
Description
Convert from text (string) to numbers.
Syntax
strval(string[], index);
Parameters
Variable | Input |
|---|---|
| The string containing a number in characters. This may be either a packed or unpacked string |
| The position in the string where to start looking for a number. This parameter allows to skip an initial part of a string, and extract numbers from the middle of a string |
NOTE: if string starts with 0x00, strval(string, index) will return 0 even when using index to skip those bytes. Workaround is strval(string[index]).
Returns
The value in the string, or zero if the string did not start with a valid number (starting at index).
Function call example
Example of converting string to value
new array1[30]=''4, 8, 15, 14, 23, 42'';
new val;
main(){
val = strval(array1, 3); // result of val = 8;
while(1){
Delay(100);
}
}