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 --- tests/library/exp-string/program.cps | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/library/exp-string/program.cps') diff --git a/tests/library/exp-string/program.cps b/tests/library/exp-string/program.cps index e789e54..0adf86c 100644 --- a/tests/library/exp-string/program.cps +++ b/tests/library/exp-string/program.cps @@ -46,6 +46,7 @@ CALL CheckLCase() CALL CheckUCase() CALL CheckAsc() CALL CheckChr() +CALL CheckIsNum() PROCEDURE CheckLeft() DECLARE Letters : _EXP_STRING((C_STRING)"ABCDEFGH") @@ -123,3 +124,15 @@ PROCEDURE CheckChr() OUTPUT _EXP_STRING_LENGTH(_EXP_STRING_CHR(0)), ":", _EXP_STRING_ASC(_EXP_STRING_CHR(0)) OUTPUT _EXP_STRING_ASC(_EXP_STRING_CHR(321)), ":", _EXP_STRING_ASC(_EXP_STRING_CHR(-1)) ENDPROCEDURE + +PROCEDURE CheckIsNum() + DECLARE Number : _EXP_STRING((C_STRING)"12.5") + DECLARE Junk : _EXP_STRING((C_STRING)"12x") + DECLARE Empty : _EXP_STRING + DECLARE Leading : _EXP_STRING((C_STRING)" 12.5") + DECLARE Trailing : _EXP_STRING((C_STRING)"12.5 ") + DECLARE Whitespace : _EXP_STRING((C_STRING)" ") + OUTPUT _EXP_STRING_IS_NUM(Number), ":", _EXP_STRING_IS_NUM(Junk), ":", _EXP_STRING_IS_NUM(Empty) + OUTPUT _EXP_STRING_IS_NUM(Leading), ":", _EXP_STRING_IS_NUM(Trailing), ":", _EXP_STRING_IS_NUM(Whitespace) + OUTPUT _EXP_STRING_IS_NUM(Number & _EXP_STRING_CHR(0)), ":", _EXP_STRING_IS_NUM(_EXP_STRING_CHR(0) & Number) +ENDPROCEDURE -- cgit v1.3.1-4-g156e