Maple Issues: Marking DNE Answers

 

Some questions require an answer like dne (Does Not Exist). You cannot just compare $RESPONSE to a string like "dne". This is because $RESPONSE has hidden characters and so is not what it appears to be. This code will strip out those chatacters and allow the comparison:

 

R:=StringTools[RegSubs]("[()*]"="","$RESPONSE");
evalb(R="dne") or evalb(R="DNE");

 

The code checks for upper or lower case. The following comparison is actually stronger, it will catch mixed-case answers like "Dne":

 

R:=StringTools[RegSubs]("[()*]"="","$RESPONSE");
evalb(StringTools[UpperCase](R)="DNE");

 


Maple Issues Index

Main Index

Last updated: 05/13/2019 SS/MUO