我一直在查看<wctype.h>
GNU LibC 赋予各种分隔符的标志。基本上有两组。
第一组在 iswspace()
上返回 true和iswblank()
(和 isprint()
,但这对于其他组也是如此)。其中包括:
- U+0020 SPACE
- U+1680 OGHAM SPACE MARK
- U+2000 EN QUAD
- U+2001 EM QUAD
- U+2002 EN SPACE
- U+2003 EM SPACE
- U+2004 THREE-PER-EM SPACE
- U+2005 FOUR-PER-EM SPACE
- U+2006 SIX-PER-EM SPACE
- U+2008 PUNCTUATION SPACE
- U+2009 THIN SPACE
- U+200a HAIR SPACE
- U+205f MEDIUM MATHEMATICAL SPACE
- U+3000 IDEOGRAPHIC SPACE
到目前为止没有任何投诉。不过,其他组让我感到困惑:
这些在 iswspace()
上返回 false和iswblank()
,但 iswpunct()
为 true和iswgraph()
.
为什么最后三个被认为是标点符号,而不是空格?
显然,Java 在这一点上与 GLibC 一致(参见链接页面)。 Unicode将两个组标记为类别“Zs”、“Space_Separator”...
最佳答案
ISO/IEC 30112 信息技术 - 文化习俗的规范方法指出,我的重点是:
space
Define characters to be classified as white-space characters, to find syntactical boundaries. [...] The class should not include the NO-BREAK spaces characters
<U00A0>
,<U2007>
,<UFEFF>
, as these characters should not be used for word boundaries.
关于c - 为什么 "no-break space"和其他 ispunct() 在 GLibC 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50952142/