c 23 how to get src from html img

Solutions on MaxInterview for c 23 how to get src from html img by the best coders in the world

showing results for - "c 23 how to get src from html img"
Niko
14 Sep 2020
1string str = "<div> <img src=\"https://i.testimg.com/images/g/test/s-l400.jpg\" style=\"width: 100%;\"> <div>Test</div> </div>";
2
3// Get the index of where the value of src starts.
4int start = str.IndexOf("<img src=\"") + 10;
5
6// Get the substring that starts at start, and goes up to first \".
7string src = str.Substring(start, str.IndexOf("\"", start) - start);
8
Elías
23 Oct 2018
1var shieldHomeContainer = nodeCollection.SelectSingleNode("//img").Attributes["src"].Value;
2