Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inconsistent Results
#4
There is one weak place:

c.trim("AMOUNT (")

Here "AMOUNT (" is set of characters that are trimmed. Now this succeeds, and it would also succeed if c would be eg "TNU 100,000.00A". But if c sometimes has different format, this statement may fail to extract the number. Then c would not be numeric, and a=c would throw "...Type mismatch" error.

Regular expressions are ideal to extract numbers and other complex substrings. Try this:

Code:
Copy      Help
CURRENCY a b="100000"
str c="AMOUNT (100,000.00)"

if(findrx(c "\d+(,\d+)*\.\d\d" 0 2 c)<0) out "number not found"; ret
a=c

mes iif(a<=b "ok" "not ok")

To show last error line, press F2. To show automatically, set it in Options.


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)