WikiFunctions.Tools.ReplaceOnce C# (CSharp) Method

ReplaceOnce() public static method

Replaces first occurrence of a given text within a StringBuilder
public static ReplaceOnce ( StringBuilder text, string oldValue, string newValue ) : bool
text StringBuilder Text to be processed
oldValue string Text to be replaced
newValue string Replacement text
return bool
        public static bool ReplaceOnce(StringBuilder text, string oldValue, string newValue)
        {
            int index = text.ToString().IndexOf(oldValue);
            if (index < 0)
                return false;

            text.Replace(oldValue, newValue, index, oldValue.Length);
            return true;
        }

Same methods

Tools::ReplaceOnce ( string &text, string oldValue, string newValue ) : bool
Tools