开发者

Extract part of string in flash

I have this string

<p><img src="http://www.foo.com/bar.jpg">&l开发者_运维百科t;/p><p>other content here</p>

I need to extract the src url . The img tag appears only at the beggining of the string.

Thanks in advance.


You can use String.split:

var s:String = "<p><img src=\"http://www.foo.com/bar.jpg\"></p><p>other content here</p>";
var a:Array = s.split('"');

The src url would be the 2nd element of the array, so:

trace(a[1]);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜