KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How would I convert a string, say "-100,100", to long in C#. I currently have a line of code which is long xi = long.Parse(x, System.Globalization.NumberStyles.AllowThousands); but this breaks when x is "a negative number". My approach : long xi = long.Parse("-100,253,1", System.Globalization.NumberStyles.AllowLeadingSign & System.Globalization.NumberStyles.AllowThousands); was wrong, as it broke.
Tags (comma-separated)
Save Edits
Cancel