Post Reply 
Can you check for string parameters without a magic number?
11-15-2017, 09:43 PM (This post was last modified: 11-15-2017 11:43 PM by StephenG1CMZ.)
Post: #1
Can you check for string parameters without a magic number?
You can check for floats, integers, lists etc. In PPL.

Can you detect a string too? Without using a magic number...

Code:


EXPORT STRINGMAGIC()
BEGIN
 PRINT(IFTE(TYPE(12.5)==DOM_FLOAT-1,STRING('DOM_FLOAT'),"NOT"));
 PRINT(IFTE(TYPE(#12)==DOM_INT-1,STRING('DOM_INT'),"NOT"));
 PRINT(IFTE(TYPE("ST")==DOM_STRING-1,STRING('DOM_STRING'),"OOPS"));
 PRINT(IFTE(TYPE("ST")==3-1,"It IS a THREE, NOT A STRING","OOPS"));
 PRINT(IFTE(TYPE({})==DOM_LIST-1,STRING('DOM_LIST'),"NOT"));


END;
yields:
DOM_FLOAT
DOM_INT
OOPS
It IS a THREE, NOT A STRING
DOM_LIST
Is there an alternative constant?

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Can you check for string parameters without a magic number? - StephenG1CMZ - 11-15-2017 09:43 PM



User(s) browsing this thread: 1 Guest(s)