M
Markus
Hello all,
I have the strange problem that a string isn't equal to
the same character sequence in my code. e.g.
1st assign:
String str="Hello"
then later:
(str=="Hello") results in false.
The actual sequence involves writing and reading to a file
and I'm hoping it contains some oversight:
I assign the value "Hello" to my string str. I use
StreamWriter.Write(str) to write to a file. A custom
function reads the file and parses it into words by using,
in essence:
int i=StreamReader.Read();
char c=(char)i;
str+=c;
When it is finished, the string appears to be
reconstructed. It has the same length and contains the
same sequence of individual characters, as far as I can
verify in the Immediate Command Window. Also,
String.Compare(str,"Hello") results in 0 (or equals), but
String.Equals(str,"Hello") results in false, and the
switch statement in my code won't assign the string to the
correct case (which is how I discovered the problem).
So what am I missing, some hidden encoding going on
somewhere?
Many thanks for any reponse,
Markus
I have the strange problem that a string isn't equal to
the same character sequence in my code. e.g.
1st assign:
String str="Hello"
then later:
(str=="Hello") results in false.
The actual sequence involves writing and reading to a file
and I'm hoping it contains some oversight:
I assign the value "Hello" to my string str. I use
StreamWriter.Write(str) to write to a file. A custom
function reads the file and parses it into words by using,
in essence:
int i=StreamReader.Read();
char c=(char)i;
str+=c;
When it is finished, the string appears to be
reconstructed. It has the same length and contains the
same sequence of individual characters, as far as I can
verify in the Immediate Command Window. Also,
String.Compare(str,"Hello") results in 0 (or equals), but
String.Equals(str,"Hello") results in false, and the
switch statement in my code won't assign the string to the
correct case (which is how I discovered the problem).
So what am I missing, some hidden encoding going on
somewhere?
Many thanks for any reponse,
Markus