Let's say I have a string which has relational operators:
"x<y , x=y , x<=y , x>y , x>=y"
How can I split this?
If I use [<>=]
it'll split x<=y
as (x
and =y
).
Is there any simple way to do it without writing our own function to split?
If you want to split using any sequence of characters (and not only any character), then you should use:
The |
|||||||||
|
You could have a Recursive Descent Parser. Is easy to implement and easy to mantain. You might want to look this. |
|||
|
[<>=]+
(not the+
) to match multiple chars – ratchet freak Apr 30 at 12:57