首页 > 编程 > .NET > 正文

自定义类(ASP.NET_VB)

2024-07-10 12:56:38
字体:
来源:转载
供稿:网友


 

imports system.diagnostics

public class fsvcommon

    '********************************************************************************************
    '功能  :关闭指定进程
    '参数  :processname:进程名
    '返回值:无
    '上传时间:2005/04/18
    '********************************************************************************************
    public shared function killprocess(byval processname as string)
        dim pprocess() as process     '进程序列
        dim myprocess as process      '进程名

        pprocess = process.getprocessesbyname(processname)
        '查找所指定的进程
        for each myprocess in pprocess
            myprocess.kill()
        next
    end function

    '********************************************************************************************
    '功能  :计算指定字符串的长度(web)
    '参数  :txtstring:指定字符串
    '返回值:长度
    '上传时间:2005/04/18
    '********************************************************************************************
    private function getlength(byval txtstring as string) as integer
        dim textlength as integer                         '字符串的长度
        textlength = txtstring.length

        dim i as integer                                  '循环变量

        for i = 0 to txtstring.length - 1
            '是否为全角字符的判断
            if not (0 <= asc(txtstring.substring(i, 1)) _
                and asc(txtstring.substring(i, 1)) <= 255) and _
                not (65377 <= asc(txtstring.substring(i, 1)) _
                and asc(txtstring.substring(i, 1)) <= 65439) then
                textlength = textlength + 1
            end if
        next

        return textlength
    end function

end class


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表