convertToHalfWidth function

String convertToHalfWidth(
  1. String text
)

Implementation

String convertToHalfWidth(String text) {
  return text.replaceAllMapped(
    RegExp(r'[0-9a-zA-Z]'),
    (m) => String.fromCharCode(m[0]!.codeUnitAt(0) - 65248),
  );
}