Is this the situation you are finding yourself in? It would help if you
could share a small code snippet demonstrating the issue you are finding.
Hi,
yes, that's the situation I experience.
I posted two messages but the second message (new topic) did not appear
here, though it's in my sent items folder. Here is a copy of that message:
Hi!
I experience a problem regarding the String.Replace() method when
running a .Net CF application with CF3.5:
When the second parameter is a string of CHR(0) the output string will
be truncated. This only occurs with CF3.5!
Running CF1.0 program with CF1.0 runtime: OK
Running CF1.0 program with CF2.0 runtime: OK
Running CF1.0 program with CF3.5 runtime: FAIL
Running CF2.0 program with CF2.0 runtime: OK
Running CF2.0 program with CF3.5 runtime: FAIL
Running CF3.5 program with CF3.5 runtime: FAIL
SAMPLE CODE:
Dim c0 As Char = Chr(0)
Dim s0 As String = New String(Chr(0), 1)
Dim s As String = "123X" + Chr(0) + "456"
' Expected: "123XX456"
MsgBox(s.Replace("X"c, c0).Replace(c0, "X"c)) '1A
MsgBox(s.Replace("X", c0).Replace(c0, "X")) '1B
MsgBox(s.Replace("X", s0).Replace(s0, "X")) '1C
' Expected: 8
MsgBox(s.Replace("X"c, c0).Length.ToString) '2A
MsgBox(s.Replace("X", c0).Length.ToString) '2B
MsgBox(s.Replace("X", s0).Length.ToString) '2C
' Expected: "X"
MsgBox(s0.Replace(c0, "X"c)) '3A
MsgBox(s0.Replace(c0, "X")) '3B
MsgBox(s0.Replace(s0, "X")) '3C
CONCLUSION:
When replacing any char with char 0 there's no problem at all.
But when replacing with a String of char 0 the output string will be
truncated: 1B, 1C, 2B, 2C will fail with CF3.5 but work with all other
runtime versions.
Kind regards,
Benjamin Lukner