camelCaseClass method

String camelCaseClass({
  1. RegExp? regExp,
})

Implementation

String camelCaseClass({RegExp? regExp}) {
  regExp ??= RegExp(r"(_)", caseSensitive: false);
  String text = "";
  for (var i = 0; i < length; i++) {
    var loopData = this[i];
    if (i == 0) {
      text += loopData.toUpperCase();
    } else {
      if (regExp.hasMatch(text[text.length - 1])) {
        text += loopData.toUpperCase();
      } else {
        text += loopData;
      }
    }
  }
  return text.replaceAll(regExp, "");
}