Hi I’m having trouble with a simple while loop in vbscript.
I’ve got a Function which splits a string of e-mail addresses based on “;” it then runs each e-mail address through another function (isValidEmail) which does some simple validation checks with a Boolean return.
If any of the “isValidEmail” functions return false I want this “EmailSplitFunc” to return false and exit otherwise I want the whole thing to return true.
I’ve got the splitting function but I’m struggling to get a While loop in which works. Any ideas?
Function EmailSplitFunc(emailaddress)
Dim EmailSplitArray, i,
EmailSplitArray = split(EmailStudentCheck,";")
While isValidEmail(EmailStudentCheck)
For i = 0 To Ubound(EmailSplitArray)
EmailStudentCheck = EmailSplitArray(i)
isValidEmail(EmailStudentCheck)
Next
Wend
End function
Start with top-level code that tests the (to be written) checkMList() function:
and add a fake checkM() function:
Then consider checkMList(): It has to split the sMList and check each part for being a valid email; finding the first failure, the function should return False, only if all parts pass the check, True should be returned. This translates to:
output: