Jump to content
Sign in to follow this  
tamir

about arrays

Recommended Posts

if i want to create array i need to write Dim $arr[number], but what do i do if i want to split text to parts and to convert all the parts to array. i don't know how many parts there will be so what do i do?

Share this post


Link to post
Share on other sites

StringSplits() creates the array for you. Just create the array as variant.

e.g.

Local $t = 'abc|adf|ert'
Local $array

$array = StringSplit($t,'|')

The $array[0] will contain the size, while $array[1] to $array[$array[0]] the elements.

Share this post


Link to post
Share on other sites

i have a file:

[]

title1

a

b

c

d

[]

title2

a

b

c

d

and i need to split the text to groups with "[]".

the problem is that when i split it some array pieces are empty (dunno why) so i use "For" loop to check if the value is empty and if it isn't i add it to new array.

u understand my problem?

Share this post


Link to post
Share on other sites

u didnt understand my question....

i did the same like u but in the "for" loop i want to check if the array doesn't have empty value. if he doesn't then i want to add him to a new array ($arr).

how do i do that?

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...