[simpits-tech] VB Code to strip digits apart

Jeroen Huijben simpits-tech@simpits.org
Tue, 18 Feb 2003 09:26:24 +0000


How about:

Dim intDigit (9) as Integer
Dim intNumber as Integer
Dim intCount as Integer

Sub funStripDigits

intCount = 10
intNumber = Val(txtTextbox)

While intCount > 0
  intCount = intCount - 1
  intDigit (intCount) = intNumber \ (10^intCount)
  intNumber = intNumber Mod (10^intCount)
Whend

End Sub

\ tells you how many times A goes fully into B.
  5 \ 2 would give 2.
Mod tells you how much remains after you've taken A fully out of B as often 
as possible.
  5 mod 2 would give 1.

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail