Code:public static string stripZero(string num) { if( num.StartsWith("0.") ) return num.Substring(1); if( num.StartsWith("-0.") ) return num.Substring(2); //EDIT: A bug in this line was identified by Peter B; see below return num; }
| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | VB Forums | Developer.com |
|
Results 1 to 13 of 13
Thread: Zeros...Threaded View
|
Click Here to Expand Forum to Full Width |