B4J Question Different result replacing text of a string and a textarea

xulihang

Active Member
Licensed User
Longtime User
Hi,

I want to replace "<Content>"&CRLF&"</Content>" to "<Br />".

Replacing text in a textarea works but replacing on a string did not work. I cannot figure out what is the difference.

B4X:
Sub Button1_MouseClicked (EventData As MouseEvent)
    Dim xml As String
    xml=File.ReadString(File.DirApp,"Story_u1ab14.xml")
    xml=xml.Replace("<Content>"&CRLF&"</Content>","<Br />")
    TextArea1.Text=xml
End Sub

Sub Button2_MouseClicked (EventData As MouseEvent)
    TextArea2.Text=File.ReadString(File.DirApp,"Story_u1ab14.xml")
    TextArea2.Text=TextArea2.Text.Replace("<Content>"&CRLF&"</Content>","<Br />")
End Sub

upload_2018-10-11_11-56-28.png
 

xulihang

Active Member
Licensed User
Longtime User
This is the test project file.
 

Attachments

  • replace.zip
    3.1 KB · Views: 121
Upvote 0
Top