c# - Not removing a substring from a string -


i trying remove substring string in simple code. c# not removing it:

stringcmd = "haha wowi in love!" stringcmd.remove(stringcmd.indexof("wow"), 5); 

after removing should "haha in love!"

string.remove method returns new string without modifying 1 passed parameter, have assign variable:

stringcmd = stringcmd.remove(stringcmd.indexof("wow"), 5); 

you should aware strings in .net immutable. can read more on msdn: string (c# reference).


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -