STRING::ISFLOAT
1g 2024-04-10 laplante@plcb.ca GOWEB/STRING — Check for Floating-Point Numbertitle: “STRING::ISFLOAT” version: “1.0.0” date: 2024-04-10 author: “laplante@plcb.ca” section: “1g”
string::isfloat Check for Floating-Point Number
string::isfloat(string[, error: variable, string...])
isfloat(string[, error: variable, string...])
The isfloat
function checks whether the provided string represents a valid floating-point number.
It supports:
"4"
, "4."
)".65"
, "45.65"
)"+3.14"
, "-2.5"
)If the string cannot be parsed as a valid float, the function returns false
.
res={{
isfloat(123); "\n";
isfloat(3.1415926535); "\n";
isfloat("3.1415926535"); "\n";
isfloat("3.14159.26535"); "\n";
isfloat("45.65"); "\n";
isfloat(".65"); "\n";
isfloat("4."); "\n";
isfloat("4"); "\n";
isfloat("+4.."); "\n";
isfloat("+."); "\n";
isfloat("."); "\n";
isfloat(""); "\n";
}}.
Returns:
res=true
true
true
false
true
true
true
true
false
false
false
false
laplante@plcb.ca