Perl 函式 - tr///
■ 功 能
tr/// , tr/SEARCHLIST/REPLACEMENTLIST/
可將 SEARCHLIST 中的字串 用 REPLACEMENTLIS 取代之。
■ 語 法
tr/SEARCHLIST/REPLACEMENTLIST/
■ 傳 回 值
傳回替代或刪除的字元數
■ 範 例
程式碼
$string = 'The dog is blue.';
$string =~ tr/dog/cat/;
print "$string\n";
結果
The cat is blue.
#關鍵字 Perl 函式 - tr///用法;Perl 函式 - tr///語法;Perl 函式 - tr///範例;
■ Perl 其它函數
文章標籤
全站熱搜
