function ARC_sparql_parser::parse_NumericLiteral in Taxonomy import/export via XML 6.2
Same name and namespace in other branches
- 5.2 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_NumericLiteral()
- 5 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_NumericLiteral()
- 6 arc/ARC_sparql_parser.php \ARC_sparql_parser::parse_NumericLiteral()
2 calls to ARC_sparql_parser::parse_NumericLiteral()
File
- arc/
ARC_sparql_parser.php, line 1518
Class
Code
function parse_NumericLiteral($val = "") {
/* double */
if (preg_match("/^[0-9]*\\.?[0-9]*[eE][+-]?[0-9]+/", $val, $matches)) {
return array(
"type" => "numeric",
"val" => $matches[0],
"sub_type" => "double",
"unparsed_val" => trim(substr($val, strlen($matches[0]))),
);
}
/* decimal 1 */
if (preg_match("/^[0-9]+\\.[0-9]+/", $val, $matches)) {
return array(
"type" => "numeric",
"val" => $matches[0],
"sub_type" => "decimal",
"unparsed_val" => trim(substr($val, strlen($matches[0]))),
);
}
/* decimal 2 */
if (preg_match("/^[0-9]+\\.[0-9]*/", $val, $matches)) {
return array(
"type" => "numeric",
"val" => $matches[0],
"sub_type" => "decimal",
"unparsed_val" => trim(substr($val, strlen($matches[0]))),
);
}
/* decimal 3 */
if (preg_match("/^[0-9]*\\.[0-9]+/", $val, $matches)) {
return array(
"type" => "numeric",
"val" => $matches[0],
"sub_type" => "decimal",
"unparsed_val" => trim(substr($val, strlen($matches[0]))),
);
}
/* integer */
if (preg_match("/^[0-9]+/", $val, $matches)) {
return array(
"type" => "numeric",
"val" => $matches[0],
"sub_type" => "integer",
"unparsed_val" => trim(substr($val, strlen($matches[0]))),
);
}
/* else */
return false;
}