Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to remove decimals from string
Message
 
 
À
21/04/2010 09:17:18
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01461123
Message ID:
01461303
Vues:
38
>>>>
>>>>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('.')
>>
>>Will this make this string to be '12300' ?
>Of course, you are an observant one. I didn't see he ware removing decimals, I thought he said decimal. If he want's to remove the decimals, you can create an extension method, remove decimals.....
>
>I'll post the method if you want..

Yes, I'd like to see. Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform