I have this string for example:
2X+4+(2+2X+4X) +4
The position of the parenthesis can vary. I want to find out how can I extract the part without the parenthesis. For example I want 2X+4+4
. Any Suggestions?
I am using C#.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Try simple string Index and Substring operations as follows:
Explanation:
(
)
beginIndex
to remove the mathematical symbol like +endIndex
, till string lengthTry Regex approach:
Try this one:
This handles nested, preceding, and trailing parenthesis.