Strip Decimal and Zero Fill


/ Published in: VB.NET
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Imports System
  2. Namespace StripDecimal_VB
  3. Class RemoveDecimal
  4. Shared Sub Main(ByVal args As String())
  5. Dim testNum As Double = 255.95
  6. Dim noDecimalVal As String = testNum.ToString().Replace(".", "").PadLeft(9, "0"c)
  7.  
  8. Console.WriteLine("Original Value: " + testNum.ToString())
  9. Console.WriteLine("Value w/No Decimal: " + noDecimalVal)
  10. End Sub
  11. End Class
  12. End Namespace

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.