hexagon logo

Testing Operator input for special characters or wild cards

Anyone have an idea how to test and stop operators inputting \/:*?<>| in comments? If it contains those then it will comment back and tell them to try again? im trying to use an if_goto statements.

[C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
ENTER SERIAL NUMBER
ASSIGN/NEWSN=C1.INPUT
IF_GOTO/NEWSN=="/" ,GOTO = DEATH
IF_GOTO/NEWSN==":" ,GOTO = DEATH
IF_GOTO/NEWSN=="*" ,GOTO = DEATH
IF_GOTO/NEWSN=="?" ,GOTO = DEATH
IF_GOTO/NEWSN=="<" ,GOTO = DEATH
IF_GOTO/NEWSN==">" ,GOTO = DEATH
IF_GOTO/NEWSN=="|" ,GOTO = DEATH
IF_GOTO/NEWSN=="0" ,GOTO = DEATH
GOTO/LIVE
DEATH =LABEL/
IF/1
COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=YES,TIME DELAY=10,
DO NOT USE SPECIAL CHARACTERS FOR THE INPUT.
TRY AGAIN!
GOTO/C1
END_IF/
LIVE =LABEL/​]
Parents
  • hi,

    it looks as if you don't have the loop in it, then only the first character is tested.
    Unfortunately my example doesn't work without loops do / until


    C1 =comment/input,no,full screen=no,
    enter serial number
    assign/newsn=c1.input
    assign/vcounter=0
    if_goto/index("\/:*?<>|0",left(mid(newsn,vcounter),1))<>0,goto = death
    goto/live
    death =label/
    if/1
    comment/oper,no,full screen=yes,auto-continue=yes,time delay=10,
    do not use special characters for the input.
    Try again!
    Goto/c1
    end_if/
    live =label/​
  • maybe there was a typo in the end condition or counter?
    In my test, the loop only runs as long as there are characters in C1.INPUT
Reply Children
No Data