zoukankan      html  css  js  c++  java
  • 几个常用判断



            
    protected string AppPath(HttpRequest req)
            {
                
    string path = string.Empty;
                
    try
                {
                    path 
    = req.ApplicationPath != "/"
                        
    ? req.ApplicationPath + "/"
                        : req.ApplicationPath;

                }
                
    catch (Exception e)
                {
                    
    throw e;
                }
                
    return path;
            }





            
    protected string UrlPrefix(HttpRequest req)
            {
                
    string path = "http://"
                                
    + req.Url.Host.ToString();

                path 
    += req.ApplicationPath != "/"
                        
    ? req.ApplicationPath + "/"
                        : req.ApplicationPath;
                
    return path;
            }


    /*
             * <%# Eval("数据字段") %>  中Eval方法有两次重载
             *     Eval(string expression)  返回为object
             *     Eval(string expression,string format) 返回为string
             
    */
            
    public string GetLen(string str, int length)
            {
                
    if (str != null && str != string.Empty)
                    str 
    = str.Length > length
                        
    ? str.Substring(0, length) : str;
                
    else
                    str 
    = string.Empty;
                
    return str;

            }
  • 相关阅读:
    Git 分支管理
    Kubernetes 中文文档
    Docker 命令大全
    Redis 常用命令 大全
    Docker 资源汇总
    Docker 安装 Redis
    JavaScript闭包
    CSS选择器
    JavaScript类型转换
    javascript字符串处理方法
  • 原文地址:https://www.cnblogs.com/Bruce_H21/p/877239.html
Copyright © 2011-2022 走看看