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
  • This seems to do the trick!! Thank you for the input!


    C1 =comment/input,no,full screen=no,
    enter serial number
    assign/newsn=c1.input
    if_goto/index(newsn,"")>0,goto = death
    if_goto/index(newsn,"/")>0,goto = death
    if_goto/index(newsn,":")>0,goto = death
    if_goto/index(newsn,"*")>0,goto = death
    if_goto/index(newsn,"<")>0,goto = death
    if_goto/index(newsn,">")>0,goto = death
    if_goto/index(newsn,"?")>0,goto = death
    if_goto/index(newsn,"|")>0,goto = death
    if_goto/len(newsn)>17,goto = death
    goto/live
    death =label/
    if/1
    comment/oper,no,full screen=yes,auto-continue=yes,time delay=10,
    "do not use more than 17 and/or special characters for the input."

    try again!

    Newsn
    "is an invaild input"
    goto/c1
    end_if/
    goto/live
    live =label/​


    The following command will not work as you want it to:

    if_goto/index(newsn,"\")>0,goto = death




    if_goto/index(newsn,"\\")>0,goto = death Should work
  • yes i got that the chat msg keeps erasing it on me for some reason.. thx i got the \ to work
Reply Children
No Data