我有一个包含HTML图片的字符串,例如:
string str = "There is some nice <img alt='img1' src='img/img1.png' /> images in this <img alt='img2' src='img/img2.png' /> string. I would like to ask you <img alt='img3' src='img/img3.png' /> how Can I can I get the Lenght of the string?";
我希望获取字符串的长度,但不包括图片,并计算图片的数量。因此,结果应为:
int strLenght = 111;
int imagesCount= 3;
请问您能展示一下最有效的方式吗?
谢谢