简体   繁体   中英

converting code into classic asp

I want to convert the below string into classic asp code can any one help email has some value but it is not going inside the Loop Can any one help me.

If (IsEmpty(email) And IsNull(email)) Then

EndIf

The code looks like its VBScript already so there is no "conversion" needed, however the code is faulty. Should be:

If IsEmpty(email) Or IsNull(email) Then

End If

a variable cannot both be empty and contain a Null at the same time hence the orginal conditional expression was always false.

You could always try:

If IsEmpty(email) = True Then
    'uninitialized
ElseIf IsNull(email) = True Then
    'contains null value
ElseIf email = ""
    'contains zero length string
Else
    'Response.Write email
    'MsgBox email
End If

In most cases I try to code so that the variable is guaranteed to be initialized so you don't need to run the IsEmpty check.

Option Explicit

Dim email
email = ""

Why don't you just check the length of the email variable:

 If Len(Trim(email)) > 0 Then

 Else

    YOUR CODE HERE

 End If

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM