Page 4 of 4 <1234
Topic Options
#30338 - 2002-10-11 08:39 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I wonder, can you in anyway click on the vartype link above to get the info directly from manual.

[ 11. October 2002, 20:42: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#30339 - 2002-10-11 08:44 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
[Smile] Array of variants. What does that mean? or do I even need to know...
Top
#30340 - 2002-10-11 08:50 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if check more on that same page:
array has it's own number but is always with something else.
12 (variant) is one of those numbers.

no, you don't need to know.
you could simply do:
code:
if 8000 < vartype($var)
"array"
else
"not array"
endif

 
_________________________
!

download KiXnet

Top
#30341 - 2002-10-11 09:00 PM Re: If...else...endif statement
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
I'd rather use the logically correct way of
code:
if vartype($var) & 8192

which checks whether the bit equaling 8192 is set or not, thus indicating whether $var is an array or not.
_________________________
There are two types of vessels, submarines and targets.

Top
#30342 - 2002-10-11 09:02 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, either way, result is the same.
_________________________
!

download KiXnet

Top
#30343 - 2002-10-11 09:05 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
is there a similar funct to INSTR for arrays?
Top
#30344 - 2002-10-11 09:07 PM Re: If...else...endif statement
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
There is an IsInArray() UDF posted in the UDF Forum.
_________________________
There are two types of vessels, submarines and targets.

Top
#30345 - 2002-10-11 09:07 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, you could join the array to string...

example:
$dirplus=join($dirplus,chr(10))

and then you can use instr on it.
_________________________
!

download KiXnet

Top
#30346 - 2002-10-11 10:01 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
I am really getting kinda frustrated [Mad] No matter what I try, I can't keep it from copying more than one time.
Top
#30347 - 2002-10-11 10:04 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
Lonkero, what is chr(10) in the join funct?
Top
#30348 - 2002-10-11 10:06 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
newline character.

with it you can keep the strings separated even thought they are inside same string.

if you join with nothing, it is possible to get a match without actual match.
_________________________
!

download KiXnet

Top
#30349 - 2002-10-11 10:37 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
Believe it or not, I found something that works!!!
OCCURS() searches for an element within an array. Since it searches the entire array at one time I don't have to use the FOR EACH statement. I think my problem is solved!!! [Big Grin]

[ 11. October 2002, 22:39: Message edited by: professor ]

Top
#30350 - 2002-10-11 10:38 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
prof, it's just the same as join.

anyway, good that you felt the success of finding something.
_________________________
!

download KiXnet

Top
#30351 - 2002-10-11 10:56 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
Really? Oh well... OCCURS sounds better anyway [Wink]
Thanks for all your help, and I'll post again if anything else comes up. Hopefully it's done though.

Top
Page 4 of 4 <1234


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 718 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.125 seconds in which 0.089 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org