Sign in to follow this  
Followers 0
PerryRaptor

What is the value of an empty array element?

8 posts in this topic

I'm parsing an EditBox on an IM program stuffing arrays and sniffing array elements for particular strings. I've run into a problem, I do not know what an empty element is equal to. _ArrayDisplay shows nothing for $array nor does MsgBox show anything for $array[3].

I've tried IF $array[3] == ' ' Then

I've tried IF $array[3] == " " Then

I've tried IF $array[3] == 0 Then

Share this post


Link to post
Share on other sites



I'm parsing an EditBox on an IM program stuffing arrays and sniffing array elements for particular strings. I've run into a problem, I do not know what an empty element is equal to. _ArrayDisplay shows nothing for $array nor does MsgBox show anything for $array[3].

I've tried IF $array[3] == ' ' Then

I've tried IF $array[3] == " " Then

I've tried IF $array[3] == 0 Then

Dim $a[2]

;$a[0] = 1

If $a[0] == '' Then
    MsgBox(0,"","EMPTY")
EndIf

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

that will not work

This is what _ArrayDisplay() shows:

[0] = 2

[1] = element1

[2] = element2

[3] =

What is [3] = to?

What I need is something like IF $array[3] is empty THEN ...

Edited by PerryRaptor

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

that will not work

Sure it will work, that's why I posted the code!

This is what _ArrayDisplay() shows:

[0]= 2

[1] = element1

[2] = element2

[3] =

What is [3] = to?

Either empty (see my code) or not printable, try MsgBox(0,"",String($a[3])). Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Piano Man's trick worked

IF $array[3] == "" Then ... so an empty element is equal to "" ; no space between double quotes.

Thanks guys

Share this post


Link to post
Share on other sites

Piano Man's trick worked

IF $array[3] == "" Then ... so an empty element is equal to "" ; no space between double quotes.

Thanks guys

So, what did I post? You did not even care to test it, right?

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Piano Man's trick worked

IF $array[3] == "" Then ... so an empty element is equal to "" ; no space between double quotes.

Thanks guys

No trick involved. You were checking for a space character or a number. Edited by xcal

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