[Qt-interest] indexOf empty substring

Thiago Macieira thiago.macieira at trolltech.com
Wed Feb 4 09:30:46 CET 2009


Srikanth Bemineni wrote:
>Can you please explain me this
>I want to know the defintion of an empty string.

How many characters are there between "a" and "b" in the string "ab" ? How 
many before "a" ? How many after "b" ?

How many characters are there in the empty string "" ?

So, given that the length is equal to the answers of the first paragraph, 
why shouldn't it find the empty string there?

>My problem looks like as if i am looking for a zero in one in terms of
> maths

You're not looking for a zero. You're looking for an empty set (i.e., 
looking for nothing).

You can think of a string as a set of ordered elements.

In set theory:
	∅ ⊂ set, ∀ set

Remember that empty = { }, not { ∅ } (the latter means a set of one 
element, the symbol for empty set).

Also remember that the empty set satisfies all properties (at the same 
time).

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090204/666a44b6/attachment.bin 


More information about the Qt-interest-old mailing list