注释转成Label的名称。比如:角色 - 1.超级管理员;2.部门管理员;3.普通用户 ==> 输出:角色 -- ToLabel

2017-01-30 19:03:58  访问(1389) 赞(0) 踩(0)

  • 
            /// <summary>
            /// 注释转成Label的名称。比如:角色 - 1.超级管理员;2.部门管理员;3.普通用户 ==> 输出:角色  
            /// </summary>
            /// <param name="theComment"></param>
            /// <returns></returns>
            public string ToLabel(string theComment)
            {
                if (theComment == null || theComment.Length == 0)
                    return "";
    
                int idx = theComment.IndexOf(" - ");
    
                if (idx == -1)
                    return theComment;
                else
                    return theComment.Substring(0, idx);
            }
    

  • 输入1:
    输出:

标签:注释转成Label的名称。比如:角色 - 1.超级管理员;2.部门管理员;3.普通用户 ==> 输出:角色 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)