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 | 5x 5x 54x 54x 1x 53x 53x 5x | /** * 转换为全角字符串。 * * @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 (charCode === 32) { result += String.fromCharCode(12288) } else if (charCode < 127) { result += String.fromCharCode(value.charCodeAt(i) + 65248) } else E{ result += String.fromCharCode(value.charCodeAt(i)) } } return result } |