camelize static method

String camelize(
  1. String name
)

Camelizes the given string.

  • For example, background-color' => backgroundColor`.
  • Note: for better performance, it assumes there must be a character following a dash.

Implementation

static String camelize(String name) {
  StringBuffer? sb;
  int k = 0;
  for (int i = 0, len = name.length; i < len; ++i) {
    if (name.codeUnitAt(i) == $dash) {
      if (sb == null) sb = StringBuffer();
      sb..write(name.substring(k, i))
        ..write(name[++i].toUpperCase());
      k = i + 1;
    }
  }
  return sb != null ? (sb..write(name.substring(k))).toString(): name;
}