Hi,
I have vs 2005 sp1 installed. However when I try to use .Trim (new char[] {':'}) for example it does not do anything.
string s = "h:e:l:l:o";
s.Trim (new char[] {':'});
this returns "h:e:l:l:o". Am I doing something wrong? if i use .Replace (':',string.Empty) it works.
Also in the XML visualizer, when you have something like <a></a> it shows it as <a />. is something wrong here?
Also, when trying to set next statement after while in a nested foreach loop, the debugee and thus vs2005 sp1 freeze, unless I kill the debugee by task manager (dead lock?).
other than these and 1 issue that caused vs2005 sp1 to crash (reported to ms), vs2005 sp1 seems to be stable and quite enjoyable experiance than before sp1.
-
-
1) I can think of two problems with the Trim call. The first is that Trim only removes the given character from the beginning and end of the string. string.Replace might be what you're after. The second is that Trim, like all string functions, doesn't modify the string itself but rather returns a new string with the given result. Code would be something like:
string myString = "hello:";
myString = myString.Trim(':');
2) <a/> is equivalent to <a></a> in XML. An empty node can be shortened, to save space and simplify the display.
3) Can't help you with the freezing, I'm afraid.
-
Yggdrasil wrote:
1) I can think of two problems with the Trim call. The first is that Trim only removes the given character from the beginning and end of the string. string.Replace might be what you're after. The second is that Trim, like all string functions, doesn't modify the string itself but rather returns a new string with the given result. Code would be something like:
string myString = "hello:";
myString = myString.Trim(':');
2) <a/> is equivalent to <a></a> in XML. An empty node can be shortened, to save space and simplify the display.
3) Can't help you with the freezing, I'm afraid.
Thanks for the help. I reported #3 to MS.
Re: The second is that Trim, like all string functions, doesn't modify the string itself but rather returns a new string with the given result.
But with myString.Replace (":",String.Empty), it will modify the string itself, without having to set it to it, no? -
No, it won't. Strings are immutable and can not be manipulated like that. You have to assign the result of the Replace-method to a new or existing variable. Like this: myString = myString.Replace(":", "");
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.