我只想获取 "<img"
之前的数据标签。
我的代码如下:我怎样才能完成它?
string body = row[2].ToString();
int num;
num = body.IndexOf("<img");
最佳答案
// first find the index of your starting point
int start = body.IndexOf("<img");
// then find the index of your ending point
int end = body.IndexOf("\"", start);
// then retrieve that portion of the string
string goods = body.Substring(start, end - start);
关于c# - 在达到特定字符之前如何获取字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9852154/