Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to remove decimals from string
Message
From
20/04/2010 14:42:44
John Baird
Coatesville, Pennsylvania, United States
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01461123
Message ID:
01461188
Views:
50
>
>OK. 'Twas drive-past coding. So's this:
string s = "123.00";
>string cut = s.IndexOf(".") > 0 ? s.Substring(0, s.IndexOf(".")) : s;
>
I'll do unit testing later :-}


I created an extension method called RemoveChar that takes the char to remove, ergo... string.RemoveChar('.')
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform