isOperator function

bool isOperator(
  1. String s
)

Returns true if s represents an arithmetic operator, false otherwise.

This function checks the input string against a set of predefined arithmetic operators. If the input string matches any of the operators, the function returns true. Otherwise, it returns false.

Implementation

bool isOperator(String s) {
  return s == '+' || s == '-' || s == '*' || s == '/' || s == '×' || s == '÷';
}