0

I want to make an input stream parser capable of handling input in any of the following forms:

x y z
x,y,z
x, y, z
(x,y,z)
(x, y, z)

Is there a clever way to do this? Or do I have to check the first character, if it is '(' then do one thing, if it is not then read a double, then check if the next character is a ',', etc etc.

Is there a robust way to handle these types of inputs?

Thanks,
Dave

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ArkM
0

I want to make an input stream parser capable of handling input in any of the following forms:

x y z
x,y,z
x, y, z
(x,y,z)
(x, y, z)

Is there a clever way to do this? Or do I have to check the first character, if it is '(' then do one thing, if it is not then read a double, then check if the next character is a ',', etc etc.

Is there a robust way to handle these types of inputs?

Of course, there is a robust way...
That's it:

I have to check the first character, if it is '(' then do one thing, if it is not then read a double, then check if the next character is a ',', etc etc.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.