Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 6x 6x 59x 59x 54x 5x 1x 4x 6x | /**
 * 转换为全角字符串。
 *
 * @param value 要转换的字符串
 * @returns 返回转换后的全角字符串
 */
export function toFullWidthString(value: string): string {
  let result = ''
  for (let i = 0; i < value.length; i++) {
    const charCode = value.charCodeAt(i)
    if (0x0020 < charCode && charCode < 0x007f) {
      result += String.fromCharCode(charCode + 0xfee0)
    } else if (0x0020 === charCode) {
      result += String.fromCharCode(0x3000)
    } else {
      result += value[i]
    }
  }
  return result
}
  |