[simpits-tech] VB Code to strip digits apart

Erwin Neyt simpits-tech@simpits.org
Tue, 18 Feb 2003 11:05:03 +0100


Aha, a four-liner :) Good work Jeroen.

Anyone going for less!? 

Erwin.

> -----Original Message-----
> From: Jeroen Huijben [mailto:jeroen_huijben@hotmail.com] 
> Sent: dinsdag 18 februari 2003 10:26
> To: simpits-tech@simpits.org
> Subject: Re: [simpits-tech] VB Code to strip digits apart
> 
> 
> 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
> 
> _______________________________________________
> Simpits-tech mailing list
> Simpits-tech@simpits.org 
> http://www.simpits.org/mailman/listinfo/simpit> s-tech
> To 
> unsubscribe, please see the instructions at the 
> bottom of the above page.  Thanks!
>