Reputation: 3811
There is a excel formula like :
=A2/B2*C2+D2
i expect to call somemethod like :
var formula = "=A2/B2*C2+D2";
var list = SomeMethod(formula);
and get List data like :
[0]:=
[1]:A2
[2]:/
[3]:B2
[4]:*
[5]:C2
[6]:+
[7]:D2
i have tried using regex for a while but i still have no idea.
Upvotes: 0
Views: 59
Reputation: 889
Use Excel formula Parser
for the case,
check out here or here
EDIT
For Simple use case like only few operators +
, -
, /
you could use following version,
string[] splits = Regex.Split("=A2/B2*C2+D2", @"(?<=[+-=*/])");
Upvotes: 2