Sign in to follow this  
Followers 0
Queener

Array - get the number of the elements

7 posts in this topic

#1 ·  Posted (edited)

-------------------------EDIT-----------------------

I think I know the work around, but I'm not sure how to rephrase it...

Say we have

[John]
ID=123
 
[James]
ID=234
 
[Jack]
ID=543

How do I code so msgbox return the number of element that display in $inputsearch2?

so if James was input in $inputsearch2, msgbox would return 2 or Jack in $inputsearch2 then msgbox return 3.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <Array.au3>
$searchThisSection = "James"
$array = IniReadSectionNames("c:\temp\test.ini")
msgbox(0,0,_ArraySearch($array, $searchThisSection))

Something like that?

... if I paste your data in my ini file and run it, I get a msgbox stating "2". That is what you mean, I guess? If not, please post more example code. Merely mentioning a variable called "$inputsearch2" doesn't tell us a whole lot about the situation in question :)

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

asianqueen,

You changed the title and the text to something quite different from the origional, probably because you did not get a reply.  The reason you did not get a reply was because your question was not clear and what you posted was not runnable, nor was there any discernable flow, just fragments. 

As you have seen, the forum members are very helpfull but we need something to go on.  Please post runnable code and/or define what you expect and what is going wrong.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

asianqueen,

You changed the title and the text to something quite different from the origional, probably because you did not get a reply.  The reason you did not get a reply was because your question was not clear and what you posted was not runnable, nor was there any discernable flow, just fragments. 

As you have seen, the forum members are very helpfull but we need something to go on.  Please post runnable code and/or define what you expect and what is going wrong.

kylomas

 

 

Yes I have changed the title to rephrase it so it's easier to understand of what I'm aiming for. Will test the code and see if it works...


Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites

Yes I have changed the title to rephrase it so it's easier to understand of what I'm aiming for. Will test the code and see if it works...

 

I don't know what it was before, but it is quite hard to understand now. Was my code enough (you accepted it as an answer) or was there anything else?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't know what it was before, but it is quite hard to understand now. Was my code enough (you accepted it as an answer) or was there anything else?

 

quite hard? hahaha you answer my question right on the point. I have another question base on array, but will create a new topic since it's different question.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites

quite hard? hahaha you answer my question right on the point. I have another question base on array, but will create a new topic since it's different question.

 

Lol, just a lucky guess then :) Well, glad it helped.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

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