Jump to content
Sign in to follow this  
smus

How to check if a string is empty

Recommended Posts

How do we check if a given string is empty or not? I've tried isNull, isEmpty as well as equal and non-equal signs, the results are the same for empty and filled texts.
My code looks like this:
 

Call am(es)
Call am(fs)

es = ""
fs = "ms"

Sub am(s)
 if s <> "" then
  response.write "The string is not empty <br>"
 else
  response.write "The string is empty <br>"
 end if
end Sub

 

Share this post


Link to post
Share on other sites
On 9/10/2018 at 11:30 PM, justsomeguy said:

That looks fine but you should probably declare your variables before you try to use them.

Added Dim es, fs but the result is the same. "The string is empty" for both cases

Share this post


Link to post
Share on other sites

You're calling the subroutine passing in variables that have not been initialized. Initialize the variables first, then call the subroutine. 

  • Thanks 1

Share this post


Link to post
Share on other sites
3 minutes ago, Ingolme said:

You're calling the subroutine passing in variables that have not been initialized. Initialize the variables first, then call the subroutine. 

Right, thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...