Hi,
i want to learn how to parse user input and check its validity in c#,
for example i want the user to input a specific format : "x,y to x,y" where x is a number and y is a number (entered by the user)
like : "1,4 to 3,8"
how do i do it?

i can do int.TryParse for each single number ( taking firs x then first y, and after, second x and second y)
but i want the user to input it all in one string and to get the x's and y's from it
how to do it

Recommended Answers

All 2 Replies

To my mind asking for a long string with various parts from the user is asking for trouble. I would suggest asking for each element and parse it as it is entered.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.