Skip to content

Commit 8ce2a36

Browse files
authored
Merge pull request #20653 from milseman/fastwidth
2 parents ae9f1b1 + 18e415b commit 8ce2a36

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

stdlib/public/core/StringGraphemeBreaking.swift

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private func _hasGraphemeBreakBetween(
3535
switch x.value {
3636
// Unified CJK Han ideographs, common and some supplemental, amongst
3737
// others:
38-
// 0x3400-0xA4CF
38+
// U+3400 ~ U+A4CF
3939
case 0x3400...0xa4cf: return true
4040

4141
// Repeat sub-300 check, this is beneficial for common cases of Latin
@@ -46,31 +46,35 @@ private func _hasGraphemeBreakBetween(
4646
case 0x0000...0x02ff: return true
4747

4848
// Non-combining kana:
49-
// 0x3041-0x3096
50-
// 0x30A1-0x30FA
49+
// U+3041 ~ U+3096
50+
// U+30A1 ~ U+30FC
5151
case 0x3041...0x3096: return true
52-
case 0x30a1...0x30fa: return true
52+
case 0x30a1...0x30fc: return true
5353

5454
// Non-combining modern (and some archaic) Cyrillic:
55-
// 0x0400-0x0482 (first half of Cyrillic block)
55+
// U+0400 ~ U+0482 (first half of Cyrillic block)
5656
case 0x0400...0x0482: return true
5757

5858
// Modern Arabic, excluding extenders and prependers:
59-
// 0x061D-0x064A
59+
// U+061D ~ U+064A
6060
case 0x061d...0x064a: return true
6161

6262
// Precomposed Hangul syllables:
63-
// 0xAC00–0xD7AF
63+
// U+AC00 ~ U+D7AF
6464
case 0xac00...0xd7af: return true
6565

6666
// Common general use punctuation, excluding extenders:
67-
// 0x2010-0x2029
67+
// U+2010 ~ U+2029
6868
case 0x2010...0x2029: return true
6969

7070
// CJK punctuation characters, excluding extenders:
71-
// 0x3000-0x3029
71+
// U+3000 ~ U+3029
7272
case 0x3000...0x3029: return true
7373

74+
// Full-width forms:
75+
// U+FF01 ~ U+FF9D
76+
case 0xFF01...0xFF9D: return true
77+
7478
default: return false
7579
}
7680
}

0 commit comments

Comments
 (0)