| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 394 人关注过本帖
标题:[求助]类中的方法问题
取消只看楼主 加入收藏
sun_life
Rank: 1
等 级:新手上路
帖 子:356
专家分:5
注 册:2006-5-29
结帖率:72.73%
收藏
 问题点数:0 回复次数:0 
[求助]类中的方法问题
我写了三个方法,被注视掉的方法没问题,但是把被注视掉的方法分解成两个(也就是后两个)就不对了
namespace managementStudents
{
    class c_IDCard          //身份证号验证
    {
        string str_IDCard;

        bool b_IDCardEmpty;

        bool b_IDCardJudgment;

        bool b_IDCardEmptyJudgment;

        public c_IDCard(string str)
        {
            str_IDCard = str.Trim();     //str.Trim()去掉str_IDCard中的左右空格
        }

        /*public bool IDCard_EmptyJudgment()      //判断输入是不是不够18位
        {
            int i;

            if (str_IDCard.Length == 18)    //判断输入是不是不够18位     
            {
                if (char.IsNumber(str_IDCard,17)||str_IDCard[17]=='x'||str_IDCard[17]=='y'||str_IDCard[17]=='X'||str_IDCard[17]=='Y') //最后一位为数字或x,y(大小写)     
                {
                    for (i = 0; i < 17; i++)    //判断前17位是不是纯数字
                    {
                        if (char.IsNumber(str_IDCard, i))
                        {
                            b_IDCardEmptyJudgment = true;
                        }
                        else
                        {
                            b_IDCardEmptyJudgment = false;

                            break;
                        }
                    }
                }
            }
            else
            {
                b_IDCardEmptyJudgment = false;
            }
            return b_IDCardEmptyJudgment;
        }*/

        public bool IDCard_Empty()
        {
            if (str_IDCard.Length == 18)
            {
                b_IDCardEmpty = true;
            }
            else
            {
                b_IDCardJudgment = false;
            }
            return b_IDCardJudgment;
        }

        public bool IDCard_Judgment()
        {
            int i;

            if(b_IDCardEmpty)
            {
                if (char.IsNumber(str_IDCard,17)||str_IDCard[17]=='x'||str_IDCard[17]=='y'||str_IDCard[17]=='X'||str_IDCard[17]=='Y') //最后一位为数字或x,y(大小写)     
                {
                    for (i = 0; i < 17; i++)    //判断前17位是不是纯数字
                    {
                        if (char.IsNumber(str_IDCard, i))
                        {
                            b_IDCardEmptyJudgment = true;
                        }
                        else
                        {
                            b_IDCardEmptyJudgment = false;

                            break;
                        }
                    }
                }
            }
            else
            {
                b_IDCardEmptyJudgment = false;
            }
            return b_IDCardEmptyJudgment;
        }


    }
}
2008-10-15 15:07
快速回复:[求助]类中的方法问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024124 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved