Re: find/match not working

new topic     » goto parent     » topic index » view thread      » older message » newer message

Kat wrote:
> 
> On 17 Aug 2004, at 8:17, don cole wrote:
> 
> > 
> > posted by: don cole <doncole at pacbell.net>
> > 
> > I re-thought this.
> <font color="#330033">> </font>
> <font color="#330033">>  </font><font color="#FF00FF">integer </font><font
> color="#330033">a</font>
> <font color="#330033">>  </font><font color="#FF00FF">sequence </font><font
> color="#330033">newlist,found</font>
> <font color="#330033">>   newlist={}</font>
> <font color="#330033">>   found={}</font>
> <font color="#330033">>  </font><font color="#0000FF">for </font><font
> color="#330033">loop=1 </font><font color="#0000FF">to </font><font
> color="#FF00FF">length</font><font color="#330033">(urllist) </font><font
> color="#0000FF">do</font>
> <font color="#330033">>    a=</font><font color="#FF00FF">find</font><font
> color="#330033">(urllist</font><font color="#993333">[</font><font
> color="#330033">loop</font><font color="#993333">]</font><font
> color="#330033">,found))</font>
> <font color="#330033">>    </font><font color="#0000FF">if </font><font
> color="#330033">a=0 </font><font color="#0000FF">then</font>
> <font color="#330033">>       found=</font><font
> color="#FF00FF">append</font><font color="#330033">(found,urllist</font><font
> color="#993333">[</font><font color="#330033">loop</font><font
> color="#993333">]</font><font color="#330033">)  </font>
> <font color="#330033">>     </font><font color="#FF0055">--
> newlist=append(newlist,urllist[loop])--you don't really need newlist</font>
> <font color="#330033">>                                         </font><font
> color="#FF0055">--unless you are going to alter</font>
> <font color="#330033">>    </font><font color="#0000FF">end if                
>                   </font><font color="#FF0055">--urllist[loop] before you add
> </font>
> <font color="#330033">>  </font><font color="#0000FF">end for                 
>                   </font><font color="#FF0055">--it to your sequence.</font>
> <font color="#330033">>  urllist=found</font>
> <font color="#330033">> </font><font color="#FF0055">--now your list is free
> of duplicates--</font>
> <font color="#330033"></font>
> <font color="#330033">The list started out </font><font color="#0000FF">with
> </font><font color="#330033">nothing in it, so i am somewhat sure it had no
> </font>
> <font color="#330033">duplicates. The following code you wrote is exactly what
> i had before i went </font>
> <font color="#0000FF">to </font><font color="#330033">using </font><font
> color="#FF00FF">match</font><font color="#330033">() instead.</font>
> <font color="#330033"></font>
> <font color="#330033">> </font><font color="#0000FF">for </font><font
> color="#330033">loop=1 </font><font color="#0000FF">to </font><font
> color="#FF00FF">length</font><font color="#330033">(urllist) </font><font
> color="#0000FF">do</font>
> <font color="#330033">>    </font><font color="#0000FF">if </font><font
> color="#FF00FF">find</font><font color="#330033">(junk,urllist</font><font
> color="#993333">[</font><font color="#330033">loop</font><font
> color="#993333">]</font><font color="#330033">) </font><font
> color="#0000FF">then</font>
> <font color="#330033">>      </font><font color="#0000FF">exit</font>
> <font color="#330033">>    </font><font color="#0000FF">end if</font>
> <font color="#330033">> </font><font color="#0000FF">end for</font>
> <font color="#330033">>   urllist=urlist & {junk}</font>
> <font color="#330033">> </font>
> > 
> > don cole
> > SF
> 
> Kat
> 
> 
Ok try
global function my_find(sequence a,sequence b)
  integer an
   a=trim(lower(a))
    b=trim(lower(b))
    an=find(a,b)
    return an
end function

global function my_match(sequence a,sequence b) integer an maches 2 squences of anny length a=trim(lower(a)) b=trim(lower(b)) an=match(a,b) return an end function

don cole SF }}}

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu