[Javascript] Zero-width char

Zhentiw發表於2024-11-28

U+200B: Zero-width space

  • Used for soft line breaks in long words.

U+FEFF: Zero-width non-breaking space

  • Prevents line breaks at specific positions.

U+200D: Zero-width joiner

  • Used in Arabic and Indic scripts to create joining effects between characters.

U+200C: Zero-width non-joiner

  • Used in Arabic, German, and Indic scripts to prevent joining effects between characters.

U+200E: Left-to-right mark

  • Used in mixed-directional text (e.g., left-to-right English mixed with right-to-left Hebrew) to specify that the text direction is left-to-right.

U+200F: Right-to-left mark

  • Used in mixed-directional text to specify that the text direction is right-to-left.

U+200B : 零寬度空格符 用於較長單詞的換行分隔
U+FEFF : 零寬度非斷空格符 用於阻止特定位置的換行分隔
U+200D : 零寬度連字元 用於阿拉伯文與印度語系等文字中,使不會發生連字的字元間產生連字效果
U+200C : 零寬度斷字元 用於阿拉伯文、德文、印度語系等文字中,阻止會發生連字的字元間的連字效果
U+200E : 左至右符 用於在混合文字方向的多種語言文字中(例:混合左至右書寫的英語與右至左書寫的希伯來語),規定排版文字書寫方向為左至右
U+200F : 右至左符 用於在混合文字方向的多種語言文字中,規定排版文字書寫方向為右至左

const str = 'a\u200Bb\u200Dc'
const str2 = 'abc'
console.log(str === str2) //false

[Javascript] Zero-width char

相關文章