mangojack Expert Licensed User Longtime User Nov 1, 2020 #1 When extracting data from a webpage scrape , I have used .Replace to remove portion of string , but the result includes unwanted / unseen spaces. A manual test works as expected... 'this works as expected ... Code: Copy Dim str As String = $"<td><img src="/images/symbols/large/storm.png" alt="$ str = str.Replace($"<td><img src="/images/symbols/large/"$, "") 'expected result ... 'storm.png" alt=' Log($"$|${str}|"$) 'as expected ... '|storm.png" alt=|' But when run as normal following webpage scrape ... Code: Copy line = TReader.ReadLine Log(line) ' as expected '<td><img src="/images/symbols/large/storm.png" alt=' line = line.Replace($"<td><img src="/images/symbols/large/"$, "") Log($"$|${line}|"$) 'Not as expected ... '| storm.png" alt=|' I am aware I can include .Trim , but I am curious as to the possible reason or what I am missing. Using temp strings did not help. Regards.
When extracting data from a webpage scrape , I have used .Replace to remove portion of string , but the result includes unwanted / unseen spaces. A manual test works as expected... 'this works as expected ... Code: Copy Dim str As String = $"<td><img src="/images/symbols/large/storm.png" alt="$ str = str.Replace($"<td><img src="/images/symbols/large/"$, "") 'expected result ... 'storm.png" alt=' Log($"$|${str}|"$) 'as expected ... '|storm.png" alt=|' But when run as normal following webpage scrape ... Code: Copy line = TReader.ReadLine Log(line) ' as expected '<td><img src="/images/symbols/large/storm.png" alt=' line = line.Replace($"<td><img src="/images/symbols/large/"$, "") Log($"$|${line}|"$) 'Not as expected ... '| storm.png" alt=|' I am aware I can include .Trim , but I am curious as to the possible reason or what I am missing. Using temp strings did not help. Regards.
Erel B4X founder Staff member Licensed User Longtime User Nov 1, 2020 #2 Check MiniHtmlParser. There are all kinds of whitespace characters (such as TAB and others). Upvote 0