本帖最后由 flashercs 于 2019-7-17 12:25 编辑
jscript脚本- var strxml = '<Button name="clean" y="#sh-940/1.5" w="270/1.5" h="235/1.5" alignV="bottom" alignChildren="true">' +
- '<Rectangle w="270/1.5" h="235/1.5" fillColor="#ffffff" strokeColor="#cdcdcd" />' +
- '</Button>';
- strxml.replace(/<[^>]+>/g, function ($0) {
- return $0.replace(/"[^"]+"/g, function ($0) {
- return $0.replace(/[-+*/%()\d.]+/g, function ($0) {
- try {
- return (eval($0)).toFixed(2);
- } catch (e) {
- return $0;
- }
- });
- });
- });
复制代码 结果为:- <Button name="clean" y="#sh-626.67" w="180.00" h="156.67" alignV="bottom" alignChildren="true"><Rectangle w="180.00" h="156.67" fillColor="#ffffff" strokeColor="#cdcdcd" /></Button>
复制代码
|