transform method

String transform(
  1. String text
)

Transforms a String to the given CaseStyle

Implementation

String transform(String text) {
  var style = this;
  if (style == null) {
    return text;
  } else {
    var words = text.split(_splitter);
    if (style.head != null) {
      words = [
        style.head.transform(words[0]),
        ...words.skip(1).map((w) => style.tail.transform(w))
      ];
    } else if (style.tail != null) {
      words = words.map((w) => style.tail.transform(w)).toList();
    }
    return words.join(style.separator);
  }
}