Created
April 21, 2026 12:37
-
-
Save trycf/50969bc01cae75a8e10471eddb3db339 to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <cfscript> | |
| public boolean function isNumber(any val) { | |
| if (!isNumeric(arguments.val)) return false; | |
| if (find(" ", arguments.val) return false; | |
| // 0001890 is not strict numeric -> serialize as string | |
| if (arguments.val >= 1 && left(arguments.val, 1) == "0") return false; | |
| // .111111 is not strict numeric -> serialize as string | |
| if (left(arguments.val, 1) == ".") return false; | |
| // 111111. is not strict numeric -> serialize as string | |
| if (right(arguments.val, 1) == ".") return false; | |
| // +111111 is not strict numeric -> serialize as string | |
| if (left(arguments.val, 1) == "+") return false; | |
| // mehrere "." auschließen | |
| if (listLen(arguments.val, ".") > 2) return false; | |
| return true; | |
| } | |
| writedump(isNumber(" 02266")) | |
| </cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment