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

> Given ( as an output from err file when i hit shift-! on the lines below
> ) :
> datatofind = {19,48'0',48'0',124'|',115's',104'h',101'e',5}
>
> Why doesn't this line execute?:
>  if find({" 00|"},{data}) then printf(1,"%s\n", {data} ) end if
>
> Or this line:
>  if find(" 00|",{data}) then printf(1,"%s\n", {data} ) end if
>
> Or this line:
>  if find(" 00|",data) then printf(1,"%s\n", {data} ) end if
>
> Or this line:
>  if ( find({" 00|"},{data}) != 0 ) then printf(1,"%s\n", {data} ) end if
>
> Or these lines:
> StartOfRec = " 00|"
> if find(StartOfRec,data) then printf(1,"%s\n", {data} ) end if
>
> Or any line with {data}/" 00|" written with/without the {}. There is
> just nothing, no error, no printing. It traces onto it, then nothing
> happens on the other screen when i hit enter.
>
> The symbol there is a double ! in my editor, i get it by ctrl-s on the
> keybd.
>
> Kat,
> bewildered.

I believe the function you are looking for is match() instead of find().
Find looks for the first argument in each element of the second argument,
while match looks for the first argument as occurring as a slice in the
second.

Going back to your original example, I would rewrite it as:

object data
integer datafound
sequence datatofind

datafound = 0 -- false

while not datafound do
       data = gets( dctstrfile )
       if atom( data ) then
           exit  -- end-of-file
       end if
       datafound = match( datatofind, data )
end while


Later,
 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu