当前位置:首页 » 编程博文
开发技术指南» 文章正文
    引言: perl中对于GBK编码的字符的处理方法 #返回字符串长度
 

 

 ·"显示桌面" 快捷方式的恢复     »显示摘要«
    摘要:平时没有注意这东西,昨天一不小心把“显示桌面”的快捷方式删掉了。恢复方法:建立一个名为“显示桌面.scf”的文本文件,内容如下:[shell]command=2iconfile=explorer.exe,3 [taskbar]command=toggledesktop然后把该文件拖放到“快速启动”工具栏中即可。 ......
 ·手把手教你禁止端口     »显示摘要«
    摘要:即使你对策略一点不懂也可以按照下面一步一步地完成禁用端口。一139为例 1.开始->控制面板(或者管理)->管理工具->本地安全策略2.右击"ip安全策略,在 本地计算机", 选择 "管理 ip 筛选器表和筛选器操作",<就可以启动管理 ip 筛选器表和筛选器操作对话框>3.在"管理 ip 筛选器表"中,按......


perl 中对于GBK编码的字符的处理方法
perl 中对于gbk编码的字符的处理方法

#返回字符串长度 【程序编程相关:Barracuda - Framewor

【推荐阅读:基于swt,使用easymock测试驱动

【扩展信息:基于VFW的视频应用程序开发

use string::multibyte;

$gbk_str="上大";

$gbk= string::multibyte->new(´gbk´);

$gbk_len = $gbk->length($gbk_str);

constructor

new(charset)">$mbcs = string::multibyte->new(charset)

new(charset,_verbose)">$mbcs = string::multibyte->new(charset, verbose)

charset is the charset name; exactly speaking, the file name of the definition file (without the suffix .pm). it returns the instance to tell methods in which charset the specified strings should be handled.

charset may be a hashref; this is how to define a charset without .pm file.

    # see perlfaq6  :-)

    my $martian  = string::multibyte->new({

        charset => "martian",

        regexp => ´[a-z][a-z]|[^a-z]´,

    });

if true value is specified as verbose, the called method (excepting islegal) will check its arguments and carps if any of them is not legally encoded.

otherwise such a check won´t be carried out (saves a bit of time, but unsafe, though you can use the islegal method if necessary).

check whether the string is legal

检测字符串是否是合法的gbk字符

islegal(list)">$mbcs->islegal(list)

returns a boolean indicating whether all the strings in arguments are legally encoded in the concerned charset. returns false even if one element is illegal in list.

length

length(string)">$mbcs->length(string)

returns the length in characters of the specified string.

reverse

字符串倒置


...   下一页
    摘要:设计模式之observer——公交篇 说到公交车,我想大家都不陌生吧,坐过公交车的朋友可能都知道,一般公交车上都有售票员(busconductor),当然无人售票车要除外了。售票员(busconductor)除了收取乘客(passenger)的车费还起着监控的作用。 下面让我们看看这个过程该如何实现呢? 1、我们先定义售票员(busconducto......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE