1. Re: [E - 1 to 2 Jun 1997] I need help! (again :>)

Joseph Martin <jam at MAILHUB.EXIS.NET> writes...

E::>I'm writing a program to read in a file and change certain pieces of
 ::>text to something else. For instance in the file I would change all
 ::>instances of '1' to '2'. However when I try to "find" the text I want
 ::>to change in my sample file it returns 0. Can anyone help?

E::>trace(1)
 ::>? file[1]
 ::>for i = 1 to length(file) do
 ::>        n = find("1", file[i])

 Your problem is right here:  find() looks for its first
 argument as a member of the sequence represented by its second
 argument.  A string in double quotes is a sequence.  You're
 actually looking for the sequence {49} in the line.  What you
 want to do instead is

 n = find('1', file[i])

 which will look for the _atom_ 49 in the line.

 =========================================================================
Jeff Zeitlin                                      jeff.zeitlin at execnet.com
---
 ~ OLXWin 1.00b ~ Mene mene tekel upharsin.

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu