## WeBWorK Main Forum

### String case sensitivity broken?

by Andrew Dabrowski -
Number of replies: 5
I've followed the directions at
http://webwork.maa.org/wiki/Introduction_to_Contexts#.W37EcBgnb04
but I can't get answers to be case sensitive. Here's a MWE.

DOCUMENT();
loadMacros("PGstandard.pl",
 "PGML.pl",
 "MathObjects.pl",
 #"contextArbitraryString.pl",
 );
TEXT(&beginproblem);
\$showPartialCorrectAnswers = 1;
Context("Numeric");
#Context("ArbitraryString");
Context()->strings->add("X" => {caseSensitive => 1});
Context()->strings->add("x" => {caseSensitive => 1});
 BEGIN_PGML
 Upper: [______]{"X"}

 Lower: [______]{"x"}

 END_PGML

ENDDOCUMENT();

This accepts "x" and "X" as correct to Upper and Lower respectively.

This seems to happen under both WW 2.12 and 2.13.

### Re: String case sensitivity broken?

by Ryan Maccombs -
x is also a variable though right? What if you try removing it is a variable.

Do you get the same error with "a" and "A"?

### Re: String case sensitivity broken?

by Andrew Dabrowski -
No dice, same result with "A" and "a". And same result using the ArbitraryString context.

### Re: String case sensitivity broken?

by Davide Cervone -
The ArbitraryString context does no parsing of the string at all, and doesn't use the context strings or other values, so setting strings in the ArbitraryString context will do nothing.

You have to provide your own checker whenever you use ArbitraryString, and so whether upper and lower case are distinguished is up to your checker.

### Re: String case sensitivity broken?

by Davide Cervone -
It does seem that the string is not maintaining its case-sensitivity flag when it comes from a Compute() call (which is what PGML uses to get its answer).

You can get around this until the is fixed by doing the following:

BEGIN_PGML
Upper: [______]{String("X")}

Lower: [______]{String("x")}

END_PGML

as that does set the flags properly.