Sign in to follow this  
Followers 0
w0uter

_DSum.

1 post in this topic

#1 ·  Posted (edited)

remember doing it in java using the % operator.

i didnt understand it so i made it in autoit :)

;===============================================================================
;
; Description:    Returns the sum of all didgits.
; Syntax:          $var = _DSum( "1b2l3a456789" )
; Parameter(s):  $i_n - String/Digits to add up to eachother.
; Requirement(s):   None
; Return Value(s):  Returns the sum of all didgits.
; Author(s):        w0uter
; Note(s):        None
;
;===============================================================================

Func _DSum($i_n)
    Local $i_r = 0
    $i_n = StringSplit($i_n & '', '')
    For $i_c = 1 To $i_n[0]
        $i_r += $i_n[$i_c]
    Next
    Return $i_r
EndFunc;==> _DSum()
Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0