我完全不知道任何正則表達式。基本上我想要做的是,我可以用它來調用錯誤(顯然)看起來像這樣的錯誤類:AS3 /正則表達式 - 替換字符串的分段
package avian.framework.errors
{
public class AvError extends Object
{
// errors
public static const LAYER_WARNING:String = "Warning: {0} is not a valid layer - the default layer _fallback_ has been used as the container for {1}.";
/**
* Constructor
* Places a warning or error into the output console to assist with misuse of the framework
* @param err The error to display
* @param params A list of Objects to use throughout the error message
*/
public function AvError(err:String, ...params)
{
trace(err);
}
}
}
我希望能夠做的就是使用LAYER_WARNING這樣的:
new AvError(AvError.LAYER_WARNING, targetLayer, this);
,並具有輸出沿着線的東西:
Warning: randomLayer is not a valid layer - the default layer _fallback_ has been used as the container for [object AvChild].
的想法是,在...params
解析,0第一個參數來代替與第二等
我已經做了一些研究,我想我已經工作了,我需要使用這個搜索模式:
var pattern:RegExp = /{\d}/;
http://gskinner.com/RegExr/desktop/&http://gskinner.com/RegExr/ – 2011-06-06 09:39:10
@Ascension Systems乾杯。 – Marty 2011-06-06 09:51:54