fixWithQuotes static method

String fixWithQuotes(
  1. String name
)

Check the tablename and fix it if necessary.

@param name the name to check. @return the fixed name.

Implementation

static String fixWithQuotes(String name) {
  if (name[0] == '\'') {
    // already fixed
    return name;
  }
  double? num = double.tryParse(name.substring(0, 1));

  if (num != null ||
      name.contains("-") ||
      name.contains(",") ||
      name.contains(RegExp(r'\s+'))) {
    return "'" + name + "'";
  }
  return name;
}