由网友(囚你无期)分享简介:在我看来,作为一个开发者,并作为一个用户,我发现一个空字符串()无用和许多混乱的原因,这好像是说字符串==的char [] 也许计算机需要空字符串,所以我想知道为什么。参见:默认字符串初始化:null或空 Best做法:?如果函数返回null或一个空对象 解决方案 有人可能会争辩说,空字符串是的空对象模式的。安东尼...
在我看来,作为一个开发者,并作为一个用户,我发现一个空字符串()无用和许多混乱的原因,这好像是说字符串==的char []
也许计算机需要空字符串,所以我想知道为什么。
参见:
默认字符串初始化:null或空 Best做法:?如果函数返回null或一个空对象 解决方案有人可能会争辩说,空字符串是的空对象模式的。安东尼指出,这是为了避免特殊情况和大量的如果
秒。
To me, as a developer and as a user, I find the empty string ("") useless and the cause of much confusion, it's like saying string == char[]
Maybe computers need the empty string, so I'd like to learn why.
See also:
Default string initialization: NULL or Empty? Best Practice: Should functions return null or an empty object?解决方案
One could argue that the empty string is an instance of the Null Object Pattern. As Anthony pointed out, this is used to avoid special cases and lots of if
s.
相关推荐
最新文章