For people with background in languages where string objects represented as arrays of characters it may be surprising, but if we try to follow such approach like
string = 'ABCDE'
characters_list = list(string)
then
'' in characters_list
will be False statement.
Empty string probably came from mathematics, where it is a neutral element for binary operation of string concatenation, i. e. for every string a
a + empty_string == empty_string + a == a
where + is a string concatenation symbol. Then "substringing" can be defined as follows:
Let's denote a is substring of b as a in b.
With these definitions of empty string and substringing relation can be proved lemma
empty_string is a substring of any string a:
a == (definition of empty_string) == empty_string + a ==
== (definition of empty_string) == empty_string + empty_string + a
then if we define c = empty_string and d = a:
a == c + empty_string + d
and by definition empty_string in a.
""contains?''is evenin ''… What are you actually trying to test? Whether your string contains a space? Or is longer than 0 characters?'ABCDE'can be represented as'' + 'ABCDE', than first occurence of empty string is zero position'foo'[0:0],'foo'[1:0], etc. The empty string can in fact be found in the string'ABCDE'. The documentation is quite clear about this as well.''fit into the stringx", then the answer is yes, since you can insert''at any point in any string without changing it, so you can arguably find it in any string, so any string contains a''. You could argue the exact opposite as well. There is no way to represent''inside a string. A string can be'', a string cannot contain''. Bottom line:'' in '...'simply makes no real sense and there's no particular correct answer I'd expect out of it.