kreverse method

String? kreverse()

反转字符串

    '123456'.kreverse() => 654321

Implementation

String? kreverse() {
  var file = this;
  if (file == null || file.kisBlank()) {
    return file;
  }
  StringBuffer sb = StringBuffer();
  for (int i = file.length - 1; i >= 0; i--) {
    var codeUnitAt = file.codeUnitAt(i);
    sb.writeCharCode(codeUnitAt);
  }
  return sb.toString();
}