C
Casper
I am seeing some really strange behavior in what should be basic
language constucts. Sometimes, when forming a new string (a) by
concanating other strings (b + c), only the first substring (b) gets
into this new string (a).
More specifically, I am concanating elements I extract from the
Arraylist type. I run .ToString() on these extractions so this should
not pose the problem.
Never the less, when concanating and trying to use this concanation as
argument for methods, it will fail in cases where the first element is
composed of alphanumeric characters - strangely enough, concanation
using values (also made ToSting() though) works fine.
// Nick (string) + IP address (string) + Port (int) yeilds ONLY the
nick!
for(int i = 0; i < PeerListGUID.Count; i++)
lstPeers.Items.Add(PeerListNick.ToString() +
PeerListIP.ToString() + "@" + PeerListPort.ToString());
// IP address (string) + Port (int) + Nick (string) yeilds desired
result
for(int i = 0; i < PeerListGUID.Count; i++)
lstPeers.Items.Add(PeerListIP.ToString() + "@" +
PeerListPort.ToString() + " " + PeerListNick.ToString());
....debugging shows its not my arrays which are "out of sync". Its
simply the concatenations that goes wrong!
Any help would be greatly appreciated,
Casper Bang, Denmark
language constucts. Sometimes, when forming a new string (a) by
concanating other strings (b + c), only the first substring (b) gets
into this new string (a).
More specifically, I am concanating elements I extract from the
Arraylist type. I run .ToString() on these extractions so this should
not pose the problem.
Never the less, when concanating and trying to use this concanation as
argument for methods, it will fail in cases where the first element is
composed of alphanumeric characters - strangely enough, concanation
using values (also made ToSting() though) works fine.
// Nick (string) + IP address (string) + Port (int) yeilds ONLY the
nick!
for(int i = 0; i < PeerListGUID.Count; i++)
lstPeers.Items.Add(PeerListNick.ToString() +
PeerListIP.ToString() + "@" + PeerListPort.ToString());
// IP address (string) + Port (int) + Nick (string) yeilds desired
result
for(int i = 0; i < PeerListGUID.Count; i++)
lstPeers.Items.Add(PeerListIP.ToString() + "@" +
PeerListPort.ToString() + " " + PeerListNick.ToString());
....debugging shows its not my arrays which are "out of sync". Its
simply the concatenations that goes wrong!
Any help would be greatly appreciated,
Casper Bang, Denmark