如何将这个字符串检查从PHP转换为AS3


How to convert this string check from PHP into AS3?

嘿,伙计们,我不知道如何在AS3中写这篇文章,但基本上我需要对输入的一些字符串进行检查。如果他们的名字前面有BTS或TS,那么就这样做,否则什么都不做。

PHP脚本:

$theid =$this->uri->segment(3);

if(substr($theid,0,3) =='BTS'){
    $theid = str_replace('BTS', 'TS', $theid);
}
$video =  $this->ecx_model->custom_search_small($theid,'any','reference_id');
if (!theid.indexOf("BTS")) theid = theid.replace(/BTS/g, "TS");

使用RegExp

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/RegExp.html