From 52e0674c54d4b53b2132e750106cc9acb266ed39 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 20 Oct 2026 11:04:39 +0000 Subject: feat(library): add experimental string IS_NUM function Co-Authored-By: Claude Opus 5.5 --- pseudocode-lib/_exp_string.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pseudocode-lib/_exp_string.cc') diff --git a/pseudocode-lib/_exp_string.cc b/pseudocode-lib/_exp_string.cc index ae53ac1..4cfd650 100644 --- a/pseudocode-lib/_exp_string.cc +++ b/pseudocode-lib/_exp_string.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -127,6 +128,14 @@ void _exp_string_impl_chr(void *Target, long long Code) { text(Target).assign(1, static_cast(static_cast(Code))); }); } +int _exp_string_impl_is_num(void *Handle) { + return checked([&]() -> int { + const auto &Source = text(Handle); + char *End = nullptr; + std::strtod(Source.c_str(), &End); + return !Source.empty() && End == Source.c_str() + Source.size(); + }); +} void _exp_string_impl_output(void *Handle) { checked([&] { const auto &Text = text(Handle); -- cgit v1.3.1-4-g156e