"\" not treated the same way as other characters when at the end of String...what to do?

Anirudh Venkataramanan shared this question 4 months ago
Needs Answer

I've attached the applet in question.


For the first input box (on the left), if the user inputs a "\" symbol at the end, the input box does not replace all the text with a red "?". It just keeps tjhe text as is. In the second input box, if the user inputs a "\" at the end, the entire input box disappears!


The current behavior when "\" is at the end of the input box should not be occuring. It should be replacing the text with a red "?". Is there anything I can do about this?

Comments (5)

photo
1

I see different behaviours in ggb v.5 and v.6.

In v.5, everything works fine as you expect (red ? after entering a \ at the end of each input in the inputboxes)


In v.6, I get the behaviour that you described.

I'm forwarding this post to the Support Team.


Note for the devs: When I opened the file for the first time in v.5, I got a warning about a scripting error at line 1 of text12 scripting. When reopening the file in v.5, the same warning wasn't displayed any longer.

photo
1

Instead of this

If(IsDefined(IndexOf("+", inTxt6)) ≟ true || IsDefined(IndexOf("y", inTxt6)) ≟ true || IsDefined(IndexOf("=", inTxt6)) ≟ true || IsDefined(IndexOf("*", inTxt6)) ≟ true || IsDefined(IndexOf("-", inTxt6)) ≟ true || IsDefined(IndexOf("/", inTxt6)) ≟ true || afunc6 != func6 || IsDefined(IndexOf("\", inTxt6)) ≟ true, SetValue(inTxt6, "?"))

why not just link the Input Boxes to numbers/functions?

photo
1

If the Input boxes were linked to numbers or functions and the correct answer was "10", the user could enter "9+1" or "12 -2" and it would still be considered correct. I don't want those versions of the answer to be correct. Only "10" should be considered correct.

photo
photo
1

There's a typo in your script, the . should be a comma (text12)


If(step == 4. SetCoords(text12, 9.24227, -5.42872))
should be


If(step == 4, SetCoords(text12, 9.24227, -5.42872))
Let us know if that fixes it or not!

photo
1

OK?

© 2019 International GeoGebra Institute