Slicing strings

Is it possible to slice strings from cell contents?

I want students to write “y = x + 4” but I only want to parse “x + 4.” I can’t find a function to slice the input string. Does one exist? Or ideas for workarounds?

Thanks!

You can separate equations into LHS expressions and RHS expressions using parseEquation.

parseEquation(input).rhs

For that example you might also consider using “xyLine”

myLine = xyLine(studentInput.latex)
mySlope = slope(myLine)
myType = 
when isLineVertical(myLine) "Vertical Line x=${xInterceptOfLine(myLine)} " 
when isLineHorizontal(myLine) "Horizontal Line with  y="${yInterceptOfLine(myLine)} "
otherwise "Your line is not Vertical nor Horizontal"

https://teacher.desmos.com/computation-layer/documentation#types:xyLine

…I suppose you should use Types instead of Function

myLine = xyLine(studentInput.latex)
mySlope = myLine.slope
myType = 
when myLine.isVertical "Vertical Line x=${myLine.xIntercept} " 
when myLine.isHorizontal "Horizontal Line with  y="${myLine.yIntercept} "
otherwise "Your line is not Vertical nor Horizontal"