XWiki.Html.HtmlUtil.RemoveSpecificTagContent C# (CSharp) Method

RemoveSpecificTagContent() public method

Removes a char sequence that starts and ends with the given valaues.
public RemoveSpecificTagContent ( String content, String tagBegining, String tagEnding ) : String
content String The initial content.
tagBegining String The begining of the char sequence.
tagEnding String The end of the char sequence.
return String
        public String RemoveSpecificTagContent(String content, String tagBegining, String tagEnding)
        {
            bool foundTags = false;
            int startIndex = 0;
            int endIndex = 0;
            do
            {
                foundTags = false;
                startIndex = content.IndexOf(tagBegining, startIndex);
                if (startIndex >= 0)
                {
                    endIndex = content.IndexOf(tagEnding, startIndex + tagBegining.Length);
                    if (endIndex >= 0)
                    {
                        content = content.Remove(startIndex, endIndex - startIndex + tagEnding.Length);
                    }
                    foundTags = true;
                    startIndex = endIndex - (endIndex - startIndex + 1);
                }
            } while (foundTags);
            return content;
        }