trim problems
-
I'm using trim function and supposed to have my string trimmed. But my string remains same. For example : " hello", the result is : " hello". But I suppose the result is : "hello". Is anyone have same problem? Anyone knows the replacement function? If using VB, I don't have problem on string operation:confused:
No one can prevent me to learn something
-
I'm using trim function and supposed to have my string trimmed. But my string remains same. For example : " hello", the result is : " hello". But I suppose the result is : "hello". Is anyone have same problem? Anyone knows the replacement function? If using VB, I don't have problem on string operation:confused:
No one can prevent me to learn something
-
I'm using trim function and supposed to have my string trimmed. But my string remains same. For example : " hello", the result is : " hello". But I suppose the result is : "hello". Is anyone have same problem? Anyone knows the replacement function? If using VB, I don't have problem on string operation:confused:
No one can prevent me to learn something
It's impossible to definitely say what you are doing wrong without actually seeing the code. My guess is that you think that the method changes the string that it's applied on, when it actually returns a new string with the modified value:
s.Trim() // creates a trimmed string and throws it away
s = s.Trim() // creates a trimmed string and assigns it to the variable
Despite everything, the person most likely to be fooling you next is yourself.
-
It's impossible to definitely say what you are doing wrong without actually seeing the code. My guess is that you think that the method changes the string that it's applied on, when it actually returns a new string with the modified value:
s.Trim() // creates a trimmed string and throws it away
s = s.Trim() // creates a trimmed string and assigns it to the variable
Despite everything, the person most likely to be fooling you next is yourself.