removeExtraParenthesis
removeExtraParenthesis(
strToClean
):string
Cleans up a given string by removing unnecessary parentheses and replacing specific patterns with placeholders for later restoration. The function processes two types of patterns:
- Substrings starting with “FC:”.
- Parentheses containing logical operators (“AND” or “OR”).
The function performs the following steps:
- Identifies and replaces “FC:” patterns with temporary placeholders.
- Iteratively removes or replaces parentheses based on their content.
- Restores the replaced placeholders back into the string.
Parameters
Parameter | Type | Description |
---|---|---|
strToClean | string | The input string to be cleaned of extra parentheses. |
Returns
string
The cleaned string with unnecessary parentheses removed and original patterns restored.