Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- testcases := [ "123"
- , "123."
- , "123.00"
- , "-10.00"
- , "abc10.-1",
- , "<10.000001>"
- , "abc"
- , "1.000000000000001"
- , "1.0000000000000001"]
- funs := ["IntegerMatchMath", "IntegerMatchRegex", "IntegerMatchRegexSimple"]
- For _, case In testcases {
- For _, fun In funs {
- OutputDebug % Format("[{}] | {} => {}", fun, case, %fun%(case))
- }
- OutputDebug `n
- }
- IntegerMatchRegex(s) {
- Return s ~= "(?<![-\.\d])+?\d+(\.(0*)(?!\d)|(?![\.\d]))" ? (s " -- 匹配") : (s " -- 不匹配")
- }
- IntegerMatchRegexSimple(s) {
- Return s ~= "^\+?\d+(\.0*)?$" ? (s " -- 匹配") : (s " -- 不匹配")
- }
- IntegerMatchMath(s) {
- Return Abs(s // 1) = s ? (s " -- 匹配") : (s " -- 不匹配")
- }
- ; [IntegerMatchMath] | 123 => 123 -- 匹配
- ; [IntegerMatchRegex] | 123 => 123 -- 匹配
- ; [IntegerMatchRegexSimple] | 123 => 123 -- 匹配
- ; [IntegerMatchMath] | 123. => 123. -- 匹配
- ; [IntegerMatchRegex] | 123. => 123. -- 匹配
- ; [IntegerMatchRegexSimple] | 123. => 123. -- 匹配
- ; [IntegerMatchMath] | 123.00 => 123.00 -- 匹配
- ; [IntegerMatchRegex] | 123.00 => 123.00 -- 匹配
- ; [IntegerMatchRegexSimple] | 123.00 => 123.00 -- 匹配
- ; [IntegerMatchMath] | -10.00 => -10.00 -- 不匹配
- ; [IntegerMatchRegex] | -10.00 => -10.00 -- 不匹配
- ; [IntegerMatchRegexSimple] | -10.00 => -10.00 -- 不匹配
- ; [IntegerMatchMath] | abc10.-1 => abc10.-1 -- 不匹配
- ; [IntegerMatchRegex] | abc10.-1 => abc10.-1 -- 匹配
- ; [IntegerMatchRegexSimple] | abc10.-1 => abc10.-1 -- 不匹配
- ; [IntegerMatchMath] | <10.000001> => <10.000001> -- 不匹配
- ; [IntegerMatchRegex] | <10.000001> => <10.000001> -- 不匹配
- ; [IntegerMatchRegexSimple] | <10.000001> => <10.000001> -- 不匹配
- ; [IntegerMatchMath] | abc => abc -- 不匹配
- ; [IntegerMatchRegex] | abc => abc -- 不匹配
- ; [IntegerMatchRegexSimple] | abc => abc -- 不匹配
- ; [IntegerMatchMath] | 1.000000000000001 => 1.000000000000001 -- 不匹配
- ; [IntegerMatchRegex] | 1.000000000000001 => 1.000000000000001 -- 不匹配
- ; [IntegerMatchRegexSimple] | 1.000000000000001 => 1.000000000000001 -- 不匹配
- ; [IntegerMatchMath] | 1.0000000000000001 => 1.0000000000000001 -- 匹配
- ; [IntegerMatchRegex] | 1.0000000000000001 => 1.0000000000000001 -- 不匹配
- ; [IntegerMatchRegexSimple] | 1.0000000000000001 => 1.0000000000000001 -- 不匹配
Add Comment
Please, Sign In to add comment