/// <summary>
        
/// convert special char to html entity
        
/// </summary>
        
/// <param name="source">source string</param>
        
/// <returns>target string</returns>
        public static string ToHtmlEntity(string source)
        {
            
if (string.IsNullOrEmpty(source))
            {
                
return string.Empty;
            }

            
string result = source.Replace("\"""&quot;"); // "
            result 
= result.Replace("'""'"); // '--> &apos;
            result = result.Replace("<""&lt;"); // <
            result = result.Replace(">""&gt;"); // >
            result = result.Replace("&""&amp;"); // &

            
return result;
        }

相关文章:

  • 2022-12-23
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-27
  • 2021-08-30
  • 2021-11-17
  • 2023-02-19
  • 2021-05-27
  • 2022-12-23
相关资源
相似解决方案