reverse function

String reverse(
  1. String text
)

反转字符串

Implementation

String reverse(String text) {
  if (text.isEmpty) {
    return "";
  }
  StringBuffer string = StringBuffer();
  for (int i = text.length - 1; i >= 0; i--) {
    string.writeCharCode(text.codeUnitAt(i));
  }
  return string.toString();
}