Bug? No warning or error

JdV

Active Member
Licensed User
Longtime User
Hello

I don't know if this is a bug or intentional but consider the following code:

B4X:
Dim MyString As String
MyString = "Hello world"
MyString.Replace("world", "everyone")
Log(MyString)
MyString = MyString.Replace("world", "everyone")
Log(MyString)

I'm assuming the line to replace "world" with "everyone" (line 3) is ignored as the first Log(MyString) outputs "Hello world".

The rest of the code behaves as expected so the second Log(MyString) outputs "Hello everyone".

Should the incorrect use of MyString.Replace on line 3 at least cause a warning or an error to appear in the logs?

Regards

Joe
 

mangojack

Expert
Licensed User
Longtime User
You are not doing anything with the 3rd line, so nothing will actually change...

Op is asking ...
Should the incorrect use of MyString.Replace on line 3 at least cause a warning or an error to appear in the logs?
 

JdV

Active Member
Licensed User
Longtime User
Thanks, that's the answer I was looking for.

I'll create a wish.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…