开发者

Extract part of string in flash

开发者 https://www.devze.com 2022-12-12 12:27 出处:网络
I have this string <p><img src=\"http://www.foo.com/bar.jpg\">&l开发者_运维百科t;/p><p>other content here</p>

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

精彩评论

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