为什么" ABCD" .StartsWith(QUOT;")返回true? [英] Why does "abcd".StartsWith("") return true?

查看:127
本文介绍了为什么" ABCD" .StartsWith(QUOT;")返回true?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题是整个问题。有人可以给我一个理由,为什么出现这种情况?

Title is the entire question. Can someone give me a reason why this happens?

推荐答案

是 - 因为它没有与空字符串开始。事实上,空字符串在逻辑上每对字符之间。

Yes - because it does begin with the empty string. Indeed, the empty string logically occurs between every pair of characters.

这样说吧:什么定义的开头你可以给将preclude呢?这里有一个简单的定义开始与这并不:

Put it this way: what definition of "starts with" could you give that would preclude this? Here's a simple definition of "starts with" that doesn't:

X与开始出现Y如果x匹配的Y的第一 y.L​​ength 字符。

"x starts with y if the first y.Length characters of x match those of y."

这是另一种(当量)的定义:

An alternative (equivalent) definition:

这篇关于为什么" ABCD" .StartsWith(QUOT;")返回true?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆