zoukankan      html  css  js  c++  java
  • 判断网址输入格式以http://开头的

     #region 方法一 判断网址输入格式
                if (txtUrl.Text .Length >=7 && txtUrl.Text.Substring(0, 7) == "http://")
                {
                     labUrl.Visible = false ;
                 }
                else 
                {
                    labUrl.Visible = true;
                    labUrl.Text = "格式为:http://...";
                 }
    
                if (txtUrlForLogo.Text .Length >=7 && txtUrlForLogo.Text.Substring(0, 7) == "http://")
                {
                    labUrlLogo.Visible = false;
                }
                else
                {
                    labUrlLogo.Visible = true;
                    labUrlLogo.Text = "格式为:http://...";
                 }
                          
                #endregion
    
                #region 方法二 判断网址输入格式
    
                if (txtUrl.Text.StartsWith("http://"))// .Substring (0,7) != "http://")
                {
                    labUrl.Visible = false;
    
                }
                else
                {
                    labUrl.Visible = true;
                    labUrl.Text = "格式为:http://...";
                }
    
                if (txtUrlForLogo.Text.StartsWith("http://"))
                {
                    labUrlLogo.Visible = false;
                }
                else
                {
                    labUrlLogo.Visible = true;
                    labUrlLogo.Text = "格式为:http://...";
                }
                #endregion
  • 相关阅读:
    ZOJ 3795 Grouping
    ZOJ 3791 An Easy Game
    ZOJ 3790 Consecutive Blocks
    POJ 1451 T9
    POJ 1141 Brackets Sequence
    POJ 2411 Mondriaan's Dream
    POJ 2513 Colored Sticks
    Eclipse 快捷键大全
    C# lock关键字(多线程)
    C# 内部类
  • 原文地址:https://www.cnblogs.com/johnwang/p/3225160.html
Copyright © 2011-2022 走看看