60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
//-----------------------------------------------------------------------
|
|
// <copyright file="StringManager.cs" company="BTU/IIT">
|
|
// Company copyright tag.
|
|
// </copyright>
|
|
// <author>stubbfel</author>
|
|
// <sience>06.06.2013</sience>
|
|
//----------------------------------------------------------------------
|
|
namespace CampusAppWPortalLib8.Utility
|
|
{
|
|
using System.Text.RegularExpressions;
|
|
|
|
/// <summary>
|
|
/// Class provides some special StringMethods
|
|
/// </summary>
|
|
public static class StringManager
|
|
{
|
|
#region Members
|
|
|
|
/// <summary>
|
|
/// Patter for Html-Tags
|
|
/// </summary>
|
|
private static readonly string HtmlTagPattern = "<.*?>";
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
/// Method removes Html-Tag of a String
|
|
/// </summary>
|
|
/// <param name="inputString">String with Html-Tags</param>
|
|
/// <returns>String without Html-Tags</returns>
|
|
public static string StripHTML(string inputString)
|
|
{
|
|
return Regex.Replace(inputString, HtmlTagPattern, string.Empty);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Method add an Newline to a string
|
|
/// </summary>
|
|
/// <param name="str">input string</param>
|
|
/// <returns>input string + newline</returns>
|
|
public static string AddNewLine(string str)
|
|
{
|
|
return str.ToString() + "\n";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Method remove(TrimEND!) an Newline to a string
|
|
/// </summary>
|
|
/// <param name="str">input string</param>
|
|
/// <returns>input string - newline</returns
|
|
public static string RemoveNewLine(string str)
|
|
{
|
|
return str.TrimEnd('\n');
|
|
}
|
|
#endregion
|
|
}
|
|
}
|