When i typed the following code the replace function does not worked can anybody tell me why is this so
Code:
dim str as string = “sample”
str.replace(“sample”,”new”)
and the resulting str value is still “sample”. It doesn’t changes to “new”.
please help if any suggestions!!!!!!!!!!!!!!!
hello friend want to tell you strings themselfves are immutable, meaning you can can’t change them. The output of the Replace method is another string. So your code will no be:
Dim result As String
result = str.Replace(“sample”,”new”)
hope this will remov ur prob…………
Leave a Reply
You must be logged in to post a comment.