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 | 2x 3x | import { padStart } from 'lodash-uni'
/**
* UTF8 字符转为 Unicode 码点。
*
* @param character 字符,支持多个字符,返回的码点将以 `-` 分割
*/
export function characterToCodepoint(character: string): string {
return Array.from(character)
.map(char => padStart(char.codePointAt(0)!.toString(16), 4, '0'))
.join('-')
}
|