A riddle

drunknhik
07-28-2004, 08:10 AM
Examine the code and the output. Tell me how this is possible, and why it is so...

rtb is a rich text box
string is a string

rtb.text = string

console.write(rtb.text = string)

produces an output of "false"

Iceplug
07-28-2004, 08:35 AM
If the RTB's MaxLength is smaller than the length of the string, the two strings will not be equal when you compare them in the console.write. :)

drunknhik
07-28-2004, 08:59 AM
If the RTB's MaxLength is smaller than the length of the string, the two strings will not be equal when you compare them in the console.write. :)
Well I was looking for a different answer...but I guess that's true...
Let's pretend that the MaxLength is of sufficient size.

Here's a hint: Is there anyway that the text can change, even ever so slightly, that only a computer, with it's very sensitive comparison techniques will pick up?

KermitDFrog
07-28-2004, 09:17 AM
wouldn't the RTB text be in a different format than the string? RTB text would be RTB format, String format i assume would be different.


~~Joe

drunknhik
07-28-2004, 09:29 AM
wouldn't the RTB text be in a different format than the string? RTB text would be RTB format, String format i assume would be different.


~~Joe

Well, correct me if I'm wrong...I don't think there is an "RTF format". It's just text with "RTF codes", of which I think can only be set through the 'rtf' property. Otherwise, it's just a regular uncoded string.

LiMuBai
07-28-2004, 10:18 AM
unicode/ansi conversion? terminating null?

drunknhik
07-28-2004, 10:31 AM
Well since everybody seems to have given up, the answer is:
If the string contains a carriage return followed by a linefeed, the rtf will only have it as a linefeed.

Therefore the two strings are not equal...

Now...if anybody can tell me why this happens?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum