r/programming • u/SerCeMan • Oct 30 '26
How hard is it to check for whitespace?
https://serce.me/posts/2026-10-30-how-hard-is-it-to-check-for-whitespace
144
Upvotes
r/programming • u/SerCeMan • Oct 30 '26
71
u/smallproton Oct 30 '26
https://en.wikipedia.org/wiki/Whitespace_(programming_language)
61
u/chucker23n Oct 30 '26
This is why I drink.
3
u/Eclipsetech Oct 31 '26
Why
1682554634?4
u/sweetno Oct 31 '26
Does anybody know if East-Asian IME produce a space that's different from the ASCII one? I for some time already think that these Unicode whitespace checks are an overkill given that the users are only ever able to type ~4 of these only.
3
u/xhivo Oct 31 '26
Just measure each glyph that way you always know if there's a zero width character or of there's whitespace with some width etc 🙃
5
u/thesituation531 Oct 31 '26
Only use ASCII. Easy.
1
u/__konrad Oct 31 '26
What about the
Character.isSpaceCharwhich returns true for 00a0?35
u/Successful-Money4995 Oct 31 '26
Fucking killed me! 😂😂😂
0
u/[deleted] Oct 30 '26
[deleted] — view deleted comment