New topic: 

indexof issue

<http://forums.realsoftware.com/viewtopic.php?t=32222>

       Page 1 of 1
   [ 7 posts ]                 Previous topic | Next topic         Author  
Message       pbart           Post subject: indexof issuePosted: Thu Jan 28, 
2010 2:43 am                               
Joined: Sat Oct 10, 2009 6:40 am
Posts: 54              Can anybody shed any light for me. I am using the 
following code:
Code:Dim i As Integer = Logfile.IndexOf(macAdd)

I know for a fact that the string macAdd appears in the array items (using 
break points), and macAdd is actually entered into the array items (among other 
stuff) when the array is appended, but i always returns -1

 any ideas anybody     
_________________
Regards
Paul
Windows 7 32bit
RB 2009 5.1  
                            Top                ZULU           Post subject: Re: 
indexof issuePosted: Thu Jan 28, 2010 3:02 am                        
Joined: Mon Jul 31, 2006 1:44 am
Posts: 1037              Code:
dim myArrStr() as String
myArrStr.Append "hello"
myArrStr.Append "sello"
myArrStr.Append "pello"

dim i as Integer = myArrStr.IndexOf("sello")

msgbox str(i)




This works ( i = 1 )  using REALbasic 2009 r5.1 on OS X 10.6 Intel

Do you know what OS you are running? And REALbasic version?     
_________________
------------------------------------  
                            Top               pbart           Post subject: Re: 
indexof issuePosted: Thu Jan 28, 2010 3:06 am                               
Joined: Sat Oct 10, 2009 6:40 am
Posts: 54              Windows 7
RB 2009 5.1     
_________________
Regards
Paul
Windows 7 32bit
RB 2009 5.1  
                            Top                ZULU           Post subject: Re: 
indexof issuePosted: Thu Jan 28, 2010 3:10 am                        
Joined: Mon Jul 31, 2006 1:44 am
Posts: 1037              OK .. I can't test on Windows ..
Did my example work for you?     
_________________
------------------------------------  
                            Top               pbart           Post subject: Re: 
indexof issuePosted: Thu Jan 28, 2010 4:10 am                               
Joined: Sat Oct 10, 2009 6:40 am
Posts: 54              Thanks ZULU

Your example worked, I'll have to double check all my code.     
_________________
Regards
Paul
Windows 7 32bit
RB 2009 5.1  
                            Top                pbart           Post subject: 
Re: indexof issuePosted: Thu Jan 28, 2010 4:26 am                               
Joined: Sat Oct 10, 2009 6:40 am
Posts: 54              Zulu
I modified your example a bit to resemble my array
Code:dim myArrStr() as String
myArrStr.Append "hello,something,00:C0:B7:CD:26:1A,bills"
myArrStr.Append "sello, bert,00:C0:B7:CD:26:1D,wombles"
myArrStr.Append "pello,00:C0:B7:CD:26:1C,wobble,elmo"

Dim s As  String = "00:C0:B7:CD:26:1D"

dim i as Integer = myArrStr.IndexOf(s)

msgbox str(i)


Now I get -1, as you can tell I am searching for a macaddress in the array 
item, is the problem the ',' or the ':' do you think.     
_________________
Regards
Paul
Windows 7 32bit
RB 2009 5.1  
                            Top                ZULU           Post subject: Re: 
indexof issuePosted: Thu Jan 28, 2010 4:40 am                        
Joined: Mon Jul 31, 2006 1:44 am
Posts: 1037              It should return -1 ...

You don't have an array item that "only" have your "search string" that you 
looking for     
_________________
------------------------------------  
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 7 posts ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to