regex - how modify my string for each ocurrence C#? -


i read

replace not modify string, creates new 1 requested modifications. else implementation detail, should not care about. if don't trust regex library, don't use it. if behaves want to, might change in future without further notice.

how use variable modification ?

regex.replace , string immutability

string immutable. means cannot modify existing string, can create new one.

however, can modify reference string.

for example:

var = "hello"; var b = a; b = "world";  console.writeline(a); console.writeline(b); 

output:

hello world 

this because when b = "world" called change reference b point "world", a still points "hello".


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -