共享 将汉字转为拼音的类

来源:互联网 发布:软件人员工资组成部分 编辑:程序博客网 时间:2024/04/30 20:16

刚刚把函数封装成了类,大家共享
下载:http://www.yemaweb.com/down/cntospell.rar
/***********************************************
*类名:cntospell
*class name:cntospell
*功能:将汉字转为拼音
*functionality:transfer character to chinese spelling
*作者:于恩水
*owner:yema
*email:woaini4651@yahoo.com.cn
*QQ:46163020
*msn:yuenshui@hotmail.com
*制作日期:2004-8-4
*date:8-4-2004
*修改次数:0
*The number for amend:0
*最后修改:2004-8-4
*end amend:8-4-2004
*备    注:此程序为免费使用的代码,可以由任何人用作任何合法的用途。
   对于代码所造成的任何损失,作者不负任何责任。
   在使用过程中不能修改和删除此注释信息,否则将追究侵犯版权的法律责任。
   如果侵犯版权将被以法律允许的最大限度的起诉。
**********************************************   以下为修改 版本修改信息
************************************************/
class cntospell
{
 var $d;   //数据对照数组//array for res data
 var $str;  //需要转的字符串
 var $outstr; //转好的字符串

 function cntospell($str="")
 {
  $this->str = $str;
 }//end function cntospell

 function setStr($str="")
 {
  $this->str = $str;
 }//end function setStr

 function tospell($str="")
 {
  if(strlen($str)>0)$this->setStr($str);
  $this->invdata();
  $this->outstr = $this->c($this->str);
  return $this->outstr;
 }//end funciton tospell

原创粉丝点击