1. silly question

Hi all, my brains must be off now (or still), because i can't figure this one.
If i
use 

while match(";",title) do 
title = title[1..match(";",title)-1] &" "&
title[match(";",title)+1..length(title)]
end while

then match() is fine. But to look for a atom numerically, i must use find():

while find(9,title) do 
title = title[1..find(9,title)-1] &" "& title[find(9,title)+1..length(title)] 
end while

What difference, other than i can spec a numeric in find(), since i cannot 
enter a "13" as a char from the keybd,, which means i cannot enter a string 
containing a CR either, except as a escaped char? 

At the moment, i don't know why i cannot get my brain around this one,, 
maybe it's too obvious..

Kat

new topic     » topic index » view message » categorize

2. Re: silly question

Hi Kat,

   as far as i got it from the manual concerning find(x,s): if the
elements of s are numbers (chars), then x has to be a number (char). If
the elements of s are strings, then x has to be a string.

Have a nice day, Rolf

new topic     » goto parent     » topic index » view message » categorize

3. Re: silly question

Kat,

if 'title' is a string (i.e a sequence with numbers 0 < numbers < 256),
then you may find a CR by
find(13,title) or a LF by find(10,title).

an alternative is: match({13},title) or even match({13,10},title) to
find CR or CRLF.

Have a nice day, Rolf

new topic     » goto parent     » topic index » view message » categorize

4. Re: silly question

Kat, sounds to me like you are trying to find a letter in a string, right?

so, I guess you have been unable to get this:

           s = find( ";", aString)

to work. Well, find() locates an atom in a string.

in euphoria, ";" is like saying {75} (I don't know the Char code for ;.)
becuase anything in " " is a sequence. If you put a single character in 
single quotes, ';' then it should work.

Try calling

          s = find(';', aString)

ciao
=====================================================
.______<-------------------\__
/ _____<--------------------__|===
||_    <-------------------/
\__|Mr Trick

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu