String Replace error

Monkey Forums/Monkey Programming/String Replace error

Emil_halim(Posted 2014) [#1]
Hi all
in my next example Replace statement has no effect does it bug or what?
Global str:String

Function Main:Int()
    
    str = "1;2;3;4;5"
    Print str
    
    str.Replace(";", " ")
    
    Print str
    Return 0
End


results

1;2;3;4;5
1;2;3;4;5


any help please.


dawlane(Posted 2014) [#2]
str.Replace(";", " ")
Should be
str = str.Replace(";", " ")
You are calling a method that will return a result.
Replace String Method


Emil_halim(Posted 2014) [#3]
thanks alot dawlane.