Jump to content

StringLen Acting Wierd


Recommended Posts

$Len = StringLen($Result)
    Msgbox(0,"",$Len)
    If $Len < 8 Then
        $digits = 8 - $Len
        For $i = 1 To $digits
            $aSpace[0] = Chr(Random(97, 122, 1)) ;a-z
            $aSpace[1] = Chr(Random(48, 57, 1)) ;0-9
            $aSpace[2] = Chr(Random(65, 90, 1)) ;A-Z
            $Adder &= $aSpace[Random(0, 3)]
        Next
        $Result = $Result & $Adder
    Else
    EndIf
    Return $Result
EndFunc   ;==>_Password

I suspected that my StringLen wasn't working as it should so I debugged it with a Msgbox. The strange thing is:

1. The msgbox pops up two times. Once with $Len as 0, the second time with $Len as the real stringlength of $Result.

What causes this "loop"? Why is $Len 0 the first time?

Link to comment
Share on other sites

Odd function start code you got there.

$Len = StringLen($Result)
...
EndFunc   ;==>_Password

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...