public string ProcessBracket(string textToProcess) { try { bool exit = false; do { textProcessed = textToProcess; int fromIndex = LastOpenIndex(textProcessed); if (fromIndex > -1) { string toProcessFormat = textProcessed.Substring(fromIndex); int toIndex = FirstCloseIndex(toProcessFormat); if (toIndex > -1) { toProcessFormat = toBeReplaced = toProcessFormat.Substring(0, FirstCloseIndex(toProcessFormat)); if (String.IsNullOrEmpty(toProcessFormat)) { return(WarningMessage.NotClosingRoundBracket); } toProcessFormat = FormatTextInsideBrackets(toProcessFormat); textToProcess = textToProcess.Replace(toBeReplaced, toProcessFormat); } } else { if (textProcessed.Contains(")")) { return(WarningMessage.NotOpeningRoundBracket); } exit = true; } } while (!exit); return(_processSquareBrackets.ProcessBracket(textToProcess)); } catch (Exception) { throw; } }
public string ProcessText(string text) { return(_textProcessor.ProcessBracket(text)); }