zoukankan      html  css  js  c++  java
  • 换行符操作

     /// <summary>
            /// 替换换行符
            /// </summary>
            /// <param name="str"></param>
            /// <returns></returns>
            public string ReplaceToHTML(string str)
            {
                if (string.IsNullOrEmpty(str))
                {
                    return str;
                }
                str = System.Text.RegularExpressions.Regex.Replace(str, @"
    ", "<br/>");
                str = System.Text.RegularExpressions.Regex.Replace(str, @"
    ", "<br/>");
                return str;
            }
            /// <summary>
            /// 还原换行符
            /// </summary>
            /// <param name="str"></param>
            /// <returns></returns>
            public string ReductionReplace(string str)
            {
                if (string.IsNullOrEmpty(str))
                {
                    return str;
                }
                str = System.Text.RegularExpressions.Regex.Replace(str, @"<br/>", "
    ");
                return str;
            }
  • 相关阅读:
    053403
    053402
    053401
    053400
    053399
    053398
    053397
    053396
    053395
    第k小数
  • 原文地址:https://www.cnblogs.com/JioNote/p/12156177.html
Copyright © 2011-2022 走看看