2012-03-22 46 views
1

嘿,我不知道如何在AS3中寫這個,但基本上我需要對一些字符串進行檢查。如果他們的名字前面有BTS或TS,那就這樣做,否則什麼也不做。如何將此字符串檢查從PHP轉換爲AS3?

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'); 

回答

3
if (!theid.indexOf("BTS")) theid = theid.replace(/BTS/g, "TS");