regularize static method

String regularize(
  1. String input
)

全角 to 半角,大写 to 小写

@param input 输入字符 @return 转换后的字符

Implementation

static String regularize(String input) {
  int charCode = input.runes.first;
  if (charCode == 12288) {
    return String.fromCharCode(32);
  } else if (charCode > 65280 && charCode < 65375) {
    return String.fromCharCode(charCode - 65248);
  } else if (charCode >= 'A'.runes.first && charCode <= 'Z'.runes.first) {
    return String.fromCharCode(charCode += 32);
  }
  return input;
}