Home Get everything before dot or comma c#
Reply: 0

Get everything before dot or comma c#

user435
1#
user435 Published in April 22, 2018, 12:51 am

how can I get a substring of everything before dot or comma?

For example:

    string input = "2.1";
int charLocation = text.IndexOf(".", StringComparison.Ordinal);
    string test = input.Substring(0, charLocation );

but what if I have an input = "2,1" ?

I would like to do it in one method, not using twice a substring (once for dot and once for comma)?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300976 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO